2

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]

6
  • Welcome to AU! Can you please reproduce the error message in your question so we can see what the issue is? You can edit your question to improve it with more info. – David Foerster Oct 21 '14 at 11:08
  • ofcourse............................... – Sandeep.B Oct 22 '14 at 12:40
  • 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] – Sandeep.B Oct 22 '14 at 12:41
  • this is the error while Iam trying copy a file tto another server via rsync – Sandeep.B Oct 22 '14 at 12:42
  • Please edit your question to include that error message so we can have all the relevant info in one place. Also the message is hard to read in comments as they don't support preformatted text sections, but questions (and answers) do. – David Foerster Oct 22 '14 at 12:54
1

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
1
  • 1
    There are many risks involved with enabling the root account and allowing remote password authentication to it. You'd be much more secure if you only used certificate based authentication for that purpose. – David Foerster Oct 22 '14 at 12:57
0

Do you know the password of root at 192.168.151.123? First command, you will copy file from local to 192.168.151.123 as root, then you have to type the password of root. Second command, you will use your username and password, so it works like charm.

1
  • I know the root password . I entered the root password correctly .. then showing permission denied – Sandeep.B Oct 22 '14 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.