NickDev
11-30-2002, 05:19 PM
i want it to send a backup of the /home/ dir to a dif server i have passwords and root to both servers and i want to set a cron to it
but when i do this it needs a password for the other server
is there a way to make it so that it remembers the password so that it will do it auto without needing me to put it in?
yellow_belly
11-30-2002, 06:28 PM
Hi - the way I did this was to setup SSH with public-private key encryption ( see man ssh for details) which enables SSH to connect without passwords and then use the command...
rsync -avz -e ssh loginname@number2server.com:/home /dirname/on/server1
HTH
YB
nozol
11-30-2002, 06:30 PM
As I remember, here are the steps to do it
Assume IP of server1= 1.1.1.1 and IP of server2= 2.2.2.2
on server1 do the following.
ssh-keygen -t dsa -f /root/.ssh/id_dsa -C "root@1.1.1.1"
scp /root/.ssh/id_dsa root@2.2.2.2:.ssh/
cat /root/.ssh/id_dsa.pub | ssh root@2.2.2.2 'cat - >> /root/.ssh/authorized_keys'
ssh-agent $SHELL
ssh-add ~/.ssh/id_dsa
Then you will be able to rsync without asked for password.
Hope this work fine for you.
another way without using rsync without ssh and entering password (when using script):
put somewhere in your script BEFORE it runs rsync:
export RSYNC_PASSWORD=<YOUR_RSYNC_PASSWD>