Ubuntu – rsync error while transfering data from one server to another

14.04backuprsyncserver

I have 2 ubuntu 14.04 servers in vm in my machine.I logged in the 2 servers as the user chandhu, then by using sudo -i , I changed as root. I have one file in the user chandhu.I wanna to move that from one server to another by using rsync. While I am entering the following command:

rsync -avh /home/chandhu/me.txt root@192.168.151.123:/home/chandhu/

there showing the error. But while I enter the command as this:

rsync -avh /home/chandhu/me.txt chandhu@192.168.151.123:/home/chandhu/

the things are going smoothly. then what was the reason for that error?

Error message is given below
rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]

Best Answer

If not already done, you have to ensure that root loging via SSH on 192.168.151.123 is permitted. Root login is denied by default. Secondly, you have to set a root password, which is also not set by default.

Permit root login:

--- ./sshd_config_2014-10-12    2014-10-21 15:00:24.354489498 +0200
+++ /etc/ssh/sshd_config    2014-10-21 15:03:03.925036747 +0200
@@ -24,7 +24,7 @@

 # Authentication:
 LoginGraceTime 120
-PermitRootLogin without-password
+PermitRootLogin yes
 StrictModes yes

 RSAAuthentication yes

Restart ssh service:

 sudo service ssh restart

Set root password:

 sudo passwd
Related Question