At 13:03 11/04/2007, you wrote:
I want to use a script to automatically backup some files from one disk to a second disk on the same box, using rsync. I already have fetchmail running as myself, and no problems with that, but the new script doesn't run unattended. If I select 'run now' in kcron it asks me for my password. When it attempts to run the unattended backup it reports Permission denied (publickey,gssapi-with-mic,password). How have I managed to screw this up? Anne
I run backup scripts using rsync at night as cron jobs at work, but between different machines across the network. I run the rsync and scp commands from within scripts as sudo -u username
The trick here is to append the ssh public key of the user you are running the scp or rsync command as, to the ~/.ssh/authorized_keys file of the owner of the target folder on the target machine.
AIUI, the reasoning is that if you have authority to put your public key onto another machine, you must therefore have authority to copy files to it, so it has no need to ask for a password.
BTW it's a while since I did it, but when you create an ssh key pair I vaguely remember being asked for a password. I think you have to make it null for the trick to work.
Hope this helps you out. Dave