You cannot use tap point - do you need any server configuration?

I am using fabric to remotely deploy my application to a rackspace server. I tried my scripts on virtual machines using the same OS (Ubuntu Server 10.04) on my home computer and they all work.

Strange, all triang put commands do not work on a real server. All other commands ( run , cd , sudo , etc.), It seems to work fine.

This only happens when targeting this particular server, this is the command I execute:

 fab test --host remote-server 

remote-server is an alias on my .ssh/config . My file:

 @task def test(): sudo("echo testing") put("/tmp/file.txt", "/tmp/") 

tmp/test_file.txt is just a text file that I use for my tests

This is the conclusion.

 [remote-server] Executing task 'test' [remote-server] sudo: echo testing [remote-server] out: testing Traceback (most recent call last): File "/home/user/env/lib/python2.6/site-packages/fabric/main.py", line 712, in main *args, **kwargs File "/home/user/env/lib/python2.6/site-packages/fabric/tasks.py", line 298, in execute multiprocessing File "/home/user/env/lib/python2.6/site-packages/fabric/tasks.py", line 197, in _execute return task.run(*args, **kwargs) File "/home/user/env/lib/python2.6/site-packages/fabric/tasks.py", line 112, in run return self.wrapped(*args, **kwargs) File "/home/user/project/fabfile/__init__.py", line 33, in test put("/tmp/file.txt", "/tmp/") File "/home/user/env/lib/python2.6/site-packages/fabric/network.py", line 457, in host_prompting_wrapper return func(*args, **kwargs) File "/home/user/env/lib/python2.6/site-packages/fabric/operations.py", line 338, in put ftp = SFTP(env.host_string) File "/home/user/env/lib/python2.6/site-packages/fabric/sftp.py", line 20, in __init__ self.ftp = connections[host_string].open_sftp() File "/home/user/env/lib/python2.6/site-packages/ssh/client.py", line 399, in open_sftp return self._transport.open_sftp_client() File "/home/user/env/lib/python2.6/site-packages/ssh/transport.py", line 844, in open_sftp_client return SFTPClient.from_transport(self) File "/home/user/env/lib/python2.6/site-packages/ssh/sftp_client.py", line 105, in from_transport chan.invoke_subsystem('sftp') File "/home/user/env/lib/python2.6/site-packages/ssh/channel.py", line 240, in invoke_subsystem self._wait_for_event() File "/home/user/env/lib/python2.6/site-packages/ssh/channel.py", line 1114, in _wait_for_event raise e ssh.SSHException: Channel closed. Disconnecting from root@server.com... done. 

Is there anything I need to configure on a remote server to send files using put ?

+6
source share
2 answers

Thanks to @Drake, I discovered that there was a problem with the sftp server on the remote machine.

To check this:

 $ sftp remote-server subsystem request failed on channel 0 Couldn't read packet: Connection reset by peer 

I read that to enable sftp I needed to add a line

 Subsystem sftp /usr/lib/openssh/sftp-server 

to /etc/ssh/sshd_config and restart ( /etc/init.d/ssh restart ) the ssh service. But the line was already there, and it did not work.

Then, after reading http://forums.debian.net/viewtopic.php?f=5&t=42818 , I changed this line to

 Subsystem sftp internal-sftp 

restarted the ssh service and now it works:

 $ sftp remote-server Connected to remote-server sftp> 
+8
source

I had the same problem. I found that sftp is not installed on my server. I installed openssh and restarted the sshd service.

 yum -y install openssh service sshd restart 

Then I also had a problem. I checked the syslog / var / log / messages. I found the following error

 Jul 3 04:23:20 <ip> sshd[13996]: subsystem request for sftp Jul 3 04:23:20 <ip> sshd[13996]: error: subsystem: cannot stat /usr/libexec/sftp- server: No such file or directory Jul 3 04:23:20 <ip> sshd[13996]: subsystem request for sftp failed, subsystem not found 

I host my sftp server location, which was located in "/ usr / libexec / openssh / sftp-server", and the script looked at the location "/ usr / libexec / sftp-server" I created a symbolic link and my problem was resolved.

 root@ <ip> fabric]# locate sftp-server /usr/libexec/openssh/sftp-server /usr/share/man/man8/sftp-server.8.gz ln -s /usr/libexec/openssh/sftp-server /usr/libexec/sftp-server 
+3
source

Source: https://habr.com/ru/post/913594/


All Articles