Rsync with ssh and root not working after change hosts IP

Solution 1:

usual way to do is

ssh-copy-id [email protected]
  • at this point, you usualy enter password for root@distant.

Next step;

rsync  [email protected] folder1 folder2    

I have trouble

And we have copied to the host:

ssh-copy-id -i /root/.ssh/id_dsa.pub [email protected]

We use the combined rsync with ssh and root, thus

 rsync -az "ssh -i /root/.ssh/id_rsa.pub" [email protected] 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.

Solution 2:

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.