[Wylug-help] rsync over ssh with cron

Chris Davies Chris.Davies at bcs.org.uk
Thu Mar 30 20:57:53 BST 2006


Anne Wilson wrote:
> I can use a longish command to rsync directories across the lan, from a 
> terminal, without the need to give a passphrase, so I tried to set up a cron 
> job to do the same at regular intervals.  Up to then I had not understood 
> that the cron job would be using a different session and therefore be unable 
> to use the authentication link that ssh-add had created.

Correct.


> It seems that if I want to do this automatically I have to use ssh without 
> passphrase, but that it is possible to exclude the use of the key from any 
> other host.

I'm not sure this is possible (but obviously others will no doubt 
contradict me). You can create a private/public key pair with 
"ssh-keygen -t rsa", and one of the options to ssh-keygen allows you to 
specify a new pair of files for the new key pair.

The ssh -i option will then let you use that new private key identity 
file (remembering that you must have put the corresponding public key on 
the remote server, first). You can use the Host and IdentityFile options 
in your local ssh_config file to preset the identity file for the 
appropriate host.

What I can't see is how to stop this public/private key pair being used 
for your account on other hosts - but I guess if someone else can access 
your own private key then the whole security thing becomes moot anyway.

Chris



More information about the Wylug-help mailing list