2

We have a server that backup multiples servers. The backups server is located in the office and all other server in the cloud.

We have moved all the server to a new IP, and from this moment the backups stopped. . In the hosts we have authorized the new IP in the rsync.conf (hosts allow = new IP ) and also in ~/.ssh/nano authorized_keys changing the from like: from="new Ip", ssh-rsa....... root@backup).

But it has not worked, so we generated new key pair without passphrase.

ssh-keygen

And we have copied to the host:

ssh-copy-id -i /root/.ssh/id_dsa.pub user@remote.host.com

We use the combined rsync with ssh and root, thus

rsync -az "ssh -i /root/.ssh/id_dsa.pub" root@remote.host. folder1
folder2

but in this case we have this error:

ERROR: The remote path must start with a module name rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9] remotehost :~/.ssh# rsync error: received SIGUSR1 (code 19) at main.c(1316) [Receiver=3.0.9]

And in the host server we have this log:

Oct 20 13:35:44 remotehost sshd[21863]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=new_IP user=root Oct 20 13:35:46 remotehost sshd[21863]: Failed password for root from New_IP port 56355 ssh2

In the host the rsync service is runing.

We have tried several methods and followed several manuals.

Can someone help me?,

Thanks in advance!!

Update1:

This is my rsyncd.conf in both node; In the backup server:

hosts allow = allow IP'S
hosts deny = *
[Remote_Server1]
path= /var/backups/server1
comment = Server1
uid = root
gid = root

[Remote_Server2]
path= /var/backups/server2
comment = Server2
uid = root
gid = root

In the remote Server:

hosts allow = backup server public IP
hosts deny = *
max connections = 48
syslog facility = daemon

[root-server1]
path = /
comment = root directory of my server1
uid = root
gid = root

[etc-server1]
path = /etc
comment = Directory of my server1
uid = root
gid = root

[home-server1]
path = /home
comment = home of my server
uid = root
gid = root

Update2:

I have ssh configured this way:

in /etc/ssh/sshd_config file

PermitRootLogin forced-commands-only
DSAAuthentication yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      %h/.ssh/authorized_keys

And moreover, in the /root/.ssh/authorized_keys file on the remote server i have (I've done it with this manual http://troy.jdmz.net/rsync/index.html) :

from="My IP",command="/home/remoteuser/cron/validate-rsync"/ ssh-dss ADCD...1234......kEY  root@backupserver

where the validate-rsync file is:

#!/bin/sh

case "$SSH_ORIGINAL_COMMAND" in
*\&*)
echo "Rejected"
;;
*\(*)
echo "Rejected"
;;
*\{*)
echo "Rejected"
;;
*\;*)
echo "Rejected"
;;
*\<*)
echo "Rejected"
;;
*\`*)
echo "Rejected"
;;
*\|*)
echo "Rejected"
;;
rsync\ --server*)
$SSH_ORIGINAL_COMMAND
;;
*)
echo "Rejected"
;;
esac

With this configuration, I run the command:

rsync -azvvv  -e "ssh -i /root/.ssh/rsync.key" root@remoteserver1::home-server1/ /home/local/

In the case i get this error:

pening connection using: ssh -i /root/.ssh/rsync.key -l root remoteserver1 rsync --server --daemon . rsync: server sent "**************************************************************************" rather than greeting rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9] [Receiver] _exit_cleanup(code=5, file=main.c, line=1534): about to call exit(5)

And in the logs i have this:

sshd[10408]: Root login accepted for forced command. sshd[10408]: Accepted publickey for root from XXX.XXX.XXX port 60543 ssh2 sshd[10408]: pam_unix(sshd:session): session opened for user root by (uid=0) sshd[10408]: pam_unix(sshd:session): session closed for user root

Update3:

The problem started since we've moved the servers to other Cloud. In fact, all existing configurations explained in this post works in the old cloud. It can be some upper level application blocking the rsync in the new cloud?. How could I check it? we have already check the ports. Thanks for all.

  • root@remote.host. folder1 is wrong, for one thing... perhaps you meant root@remote.host/folder1 ? No space, and a slash instead of a dot. – wurtel Oct 20 '15 at 13:46
  • Thanks, it was just an example. really i put something like: rsync -az "ssh -i /root/.ssh/id_dsa" root@remoteserver::/home/ /home/local/ – CRMarketing Oct 22 '15 at 9:55
  • You will need a -e before the "ssh ..." – wurtel Oct 22 '15 at 12:06
  • I tried it with rsync -az --del -H -u -e and rsync -azr --del -H -u -e and i have same error: ERROR: The remote path must start with a module name rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9] backupserver:/usr/local/sbin# rsync error: received SIGUSR1 (code 19) at main.c(1316) [Receiver=3.0.9] any suggestions plz?thanks – CRMarketing Oct 22 '15 at 13:16
  • Using a remote module looks like: root@remoteserver::home/, note no leading slash. Given the rsyncd.conf you show it would be root@remoteserver::home-server1/ i.e. use exactly the name between brackets that's in rsyncd.conf. Please edit your question to reflect corrections, e.g. the :: instead of ., actually using -e, etc. – wurtel Oct 22 '15 at 13:45
1

usual way to do is

ssh-copy-id root@remote.host.com
  • at this point, you usualy enter password for root@distant.

Next step;

rsync  root@remote.host.com folder1 folder2    
  • this will sync with root@remote.host.com home dir, use rsync root@remote.host.com:/data folder1 folder2 to sync with /data

I have trouble

And we have copied to the host:

ssh-copy-id -i /root/.ssh/id_dsa.pub user@remote.host.com

We use the combined rsync with ssh and root, thus

 rsync -az "ssh -i /root/.ssh/id_rsa.pub" root@remote.host.com folder1 folder2
  • you use both dsa and rsa ? or is this a typo ?
  • If id_rsa is your default key, there is no need to specify it.
  • as told, -i flag from ssh require a private key, not .pub available to everybody.
  • Thanks for your questions, is right has been a typo. I tried three ways: 1-Copying the old dsa public key to the server (key before the migration to the new IP), and rsync try with : rsync -az --del -H -u -e "ssh -i /root/.ssh/id_old_dsa" root@remotehost::/home/ /home/local/ 2-Generate a new dsa key, and try rsync changing id_old_dsa with id_new_dsa 3-finally generate a new rsa key, and getting: rsync -az --del -H -u -e root@remotehost::/home/ /home/local/ – CRMarketing Oct 21 '15 at 15:55
  • Comment are hard to read, can you edit your post ? – Archemar Oct 21 '15 at 16:56
  • These are the steps I Followed: First test: 1- first, I used only the DSA keys: I have generated new keys and copy it in the remote server: ssh-copy-id -i id_dsa.pub root@remote_host 2-I put: rsync -az --del -H -u -e "ssh -i /root/.ssh/id_dsa" root@remote_host::/home/ /home/local/ but Is not working, i get this error: ERROR: The remote path must start with a module name rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9] LocalHost:/usr/local/sbin# rsync error: received SIGUSR1 (code 19) at main.c(1316) [Receiver=3.0.9] (to be continue...) – CRMarketing Oct 21 '15 at 17:57
  • Second test: 1-I deleted the DSA keys from client server, and authorized_keys from remote host. 2- I generate new RSA keys, i copy the public key to the server with: ssh-copy-id -i id_rsa.pub root@remote_host 3-I Put: rsync -az --del -H -u -e root@remote_host::/home/ /home/local/ , in this case i have this result: drwxr-xr-x 4096 2015/10/21 17:23:42 But in my local server nothing has been copied, the home/ folder is empty 4- If i use:rsync -az --del -H -u -e "ssh -i /root/.ssh/id_rsa" root@remote_host::/home/ /home/local/ I get again this error: ERROR: The remote..... – CRMarketing Oct 21 '15 at 17:58
1

I guess in your rsync command you should pass the private key not the public one. Did you try connecting in ssh with the command ssh -i /root/.ssh/id_rsa.pub I guess it shouldn't work.

Edit:
Given the rsyncd.conf, I'll give you the conf if you want to push your files to the backup_server from your remote_servers (you could also want to pull files from the remote_server on the backup server).

I'm assuming you have a working ssh connection between remote_server2 to backup_server (the following command should connect you to the backup_server).

root@remote_server2 $ ssh root@backup_server

from the server you want to backup, I guess server1 from your file.

root@remote_server2 $ rsync -az /what/you/want/to/backup/ root@backup-server::Remote_Server2/ 

You also need to modify your rsyncd.conf on the backup server to

hosts allow = allow IP'S
hosts deny = *
[Remote_Server1]
path= /var/backups/server1
comment = Server1
uid = root
gid = root
read only = false

[Remote_Server2]
path= /var/backups/server2
comment = Server2
uid = root
gid = root
read only = false

You have to adapt the same to make it work for remote_server1.

  • Thank for your answere. I started from the beginning, and these are the steps I followed: 1-ssh-keygen -t rsa 2-ssh-copy-id -i id_rsa.pub root@remote_host automatically in remote server it's created authorized_keys in /root/.ssh/ 3-I put: rsync -az --del -H -u -e "ssh /root/.ssh/id_rsa" root@remote_host::/home /Home/localhome But i have this error: ERROR: The remote path must start with a module name rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9] Any suggestions plz? – CRMarketing Oct 21 '15 at 16:46
  • Okay it seems you are running rsync daemon on the remote host, in that case you have to look for what a module is, because you need to define at least one for rsync to work. You can also use rsync without rsync daemon though. – Pierre-Alain TORET Oct 21 '15 at 18:59
  • Can you explain me in with more detail or give me an example, please. Thank you – CRMarketing Oct 22 '15 at 8:19
  • Check on both nodes if you have a rsyncd process running first. In that case please add the content of the /etc/rsyncd.conf file in your post. – Pierre-Alain TORET Oct 22 '15 at 8:26
  • In both node i have chech : /etc/init.d/rsync status and i get " rsync is running." . I add the rsyncd.cond to my post, i hope your comments. Thank you – CRMarketing Oct 22 '15 at 9:09
0

We discovered the problem! We make Rsync with ssh and root. It seems that the .bachrc in the host server has an echo, and that's what gave failures (after server migration to a new server with new OS installation):

rsync: server sent "****************this is the echo**********************" rather than greeting

rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.9]

The rsync does not understand this echo, so it failed. To fix it we had to remove this echo, and the sync worked well.

Thanks to all who have commented!.

  • Pleased to hear it's fixed. If you hadn't marked out the error text with ***** it might have been easier for someone here to help you identify the issue – roaima Nov 5 '15 at 22:49
  • In reality the echo was asterisks!, (in our response we have put a comment to make it clear). – CRMarketing Nov 6 '15 at 10:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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