At the behest of Norman, here is a scheme I have just got going for
automatically updating my /stardev system using rsync and ssh. The bulk
of the trouble is in persuading ssh not to issue a prompt for a password
or passphrase.
On the local machine:
% cd ~/.ssh
% ssh-keygen -t dsa -f stardev
% vi stardev.pub
Insert the following text at the start of the line (it should currently
start with ssh-dss)
command="rsync --server --daemon ."
Leave a space between the end of this text and the following "ssh-dss"
string. Then transfer the stardev.pub file to saturn and append it to the
end of the file ~/.ssh/authorized_keys. If this file does not exist,
create it first. Then make sure that the access mode for this file is
"-rw-------" and for the .ssh directory is "drwx------"
Then create the file ~/rsyncd.conf on saturn, and put the following into it:
use chroot = no
[stardev]
path = /stardev
comment = nightly stardev build
Back on your local machine create a script containing the commands:
cd /stardev
rsync -avz -e "ssh -i /home/dsb/.ssh/rsync_dsa -l dsb" [log in to unmask]::stardev .
substituting your saturn username for dsb. You should find that this
script will do the works, without prompting for a password. This means
you can put in in your crontab, e.g.
% crontab -e
0 20 * * * $HOME/bin/rsync-stardev
to make it run at 20:00 each day.
David
|