I can connect to my server using ssh dziura and it works as it should, but I have problems copying any files to/from the server using rsync/scp/sftp.


$ scp dziura:/home/kossak/file_remote.txt .
$ scp ./file_local.txt dziura:/home/kossak/
lost connection

The first command returns 0 status, doesn't show any messages/errors and the file "file_remote.txt" is NOT copied to my local directory (I have rwx permissions to my local dir). The second command returns "lost connection"


$ rsync -Lr --partial --progress --rsh=ssh dziura:/home/kossak/file_remote.txt .
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receiver=3.1.0]


$ sftp dziura
Connection closed

I also checked /var/log/auth.log file (on the server) after running first scp command and it had lines:

Oct 27 20:26:37 dziura sshd[3027]: Accepted publickey for kossak from <MY_IP> port 34583 ssh2: RSA <...>
Oct 27 20:26:37 dziura sshd[3027]: pam_unix(sshd:session): session opened for user kossak by (uid=0)
Oct 27 20:26:38 dziura sshd[3075]: Received disconnect from <MY_IP>: 11: disconnected by user
Oct 27 20:26:38 dziura sshd[3027]: pam_unix(sshd:session): session closed for user kossak

SSH on the remote server works on standard 22 port.
I have root access to local and remote machines.
The remote server runs Ubuntu 14.04.3 LTS.
Locally I use Linux Mint 17.2.
Server name "dziura" is in ~/.ssh/config file:

Host dziura
  HostName <IP_GOES_HERE>
  User kossak
  IdentityFile /home/kossak/.ssh/id_rsa_enc

Verbose log from scp -vvv dziura:/home/kossak/file_remote.txt .: http://pastebin.com/0DkeHEC3

Any ideas how to fix this problem? Thank you.

-- EDIT --

I run my sshd in debug mode via: sudo /usr/sbin/sshd -p 2222 -D -d -e and from my local machine i tried to scp file: scp -P 2222 file_local.txt dziura:. The log on the remote server was: http://pastebin.com/xxji6ucL Scp command also displayed some environmental variables before showing "lost connection".
Here's more verbose debugging: http://pastebin.com/HiJ8qB0Y

closed as off-topic by Jeff Schaller, Kiwy, G-Man, GAD3R, Anthony Geoghegan May 3 '18 at 11:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Kiwy, G-Man, GAD3R, Anthony Geoghegan
If this question can be reworded to fit the rules in the help center, please edit the question.

  • What do you have in server config? Do you have sftp subsystem set up correctly? Is there scp binary on remote system? – Jakuje Oct 27 '15 at 19:50
  • Yes, remote server has rsync/scp/sftp commands. I don't know if sftp is setup correctly - does it matter for scp/rsync to work properly? – Kossak Oct 27 '15 at 19:54
  • Can you post verbose log from some of the failed comands, for example scp -vvv dziura:/home/kossak/file_remote.txt .? – Jakuje Oct 27 '15 at 20:08
  • 1
    Not a direct answer, but you can always fake a file transfer with something like <file_local.txt ssh dziura 'cat >file_local.txt'. (If that fails too, then it would be something really weird.) – Tom Hunt Oct 27 '15 at 20:10
  • @Jakuje pastebin.com/0DkeHEC3 – Kossak Oct 27 '15 at 20:26

Browse other questions tagged or ask your own question.