Shell-script puzzle
Anne Wilson
cannewilson at googlemail.com
Wed Apr 11 13:11:57 UTC 2007
On Wednesday 11 April 2007, David Fletcher wrote:
> 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.
>
Indirectly, it did. This is a peback situation :-) Like you, I do automated
backups from this box to the one in question, and I had based my new script
on the existing one. I had forgotten to remove the line referring to
keychain. I've removed it now, and it appears to be running correctly.
Anne
More information about the fedora-list
mailing list