[Mageia-dev] SSH PAM configuration

Renaud MICHEL r.h.michel+mageia at gmail.com
Tue Aug 14 23:12:52 CEST 2012


Hello
On Tuesday 14 August 2012 at 16:56:33, Anne Wilson wrote :
> > But even without specific setup if you can ssh between hosts
> > happily, just do "rsync -e ssh"  on the client side and just use
> > foo at remote:/path/to/files syntax. Job done :)
> 
> Sure, but knowing how prone we all are to forget, my intention was to
> do it by cron :-)

If you want to run rsync over ssh from cron, I know two possible solutions.

The first is to have a passwordless key (not readable by anyone else), then 
you simply need to use that key when connecting. That is done with the -i 
switch of ssh, so your rsync command will become
rsync -e 'ssh -i /path/to/key'
The problem is that, if you computer is stolen they can use the key as it is 
unprotected.

The other, more secure solution is to use the ssh agent. You start the agent 
with -c or -s (depending on your shell) and store its output in a file, and 
you add the necessary key to the agent (keychain can do that for you, you 
only have to type the key password). Then from your cron script, you source 
that file and the agent will be available to the rest of the script.
The drawback here, is that you must start the agent manually each time the 
computer is restarted.

Regards
-- 
Renaud Michel


More information about the Mageia-dev mailing list