miércoles, 28 de mayo de 2008

Mirror Data on Linux con Rsync

On first Server:

ssh-keygen -t dsa

(press enter twice to give a blank password)

cd
vi .ssh/.config

Press "i" to enter insert mode and copy this into the file:

Host remotehost
User remoteuser
Compression yes
Protocol 2
RSAAuthentication yes
StrictHostKeyChecking no
ForwardAgent yes
ForwardX11 yes
IdentityFile /home/localuser/.ssh/id_remotehost_dsa


Do NOT change the last line - it is supposed to say remotehost (not an actual host name). Now,

(save and exit vi)

chmod 700 .ssh
vi .ssh/id_dsa.pub

It should look like this:

ssh-dss AAAA..............v root@HOSTNAMEOFSRV01

On Second Server:

cd
vi .ssh/authorized_keys

Enter insert mode (press i) and paste the key, again ensuring that there are no spare newlines or spaces. Save the file and exit vi (press :wq then return, as above). Now you just need to set some permissions otherwise SSH will ignore the files you just created:

chmod 700 .ssh
chmod 644 .ssh/authorized_keys

Testing passwordless SSH

Rsync Replication:

rsync -e ssh -avz --delete /home/folder1/ srv02hostname:/home/folder2

No hay comentarios: