> > > Greetings,
> > >
> > > I'm in a situation where I need to copy files from one host to another
> > > via a cron job.  Automated FTP is out, due to the need for the
> > > communication to be encrypted.  Is it possible to automate scp or sftp
> > > to do this?  The only problem I can see so far is having to spec the
> > > password somehow, and I'd rather not have a password or passphrase
> > > stored in a file..

> > What you can do is to start an ssh agent as such:
> >
> > ssh-agent > .ssh/ssh-agent-init
> >
> > Add this line to your .bashrc or equivalent:
> >
> > eval  `cat $HOME/.ssh/ssh-agent-init`
> 
> Further testing reveals that this works as long as it's _only_ done on the
> sending machine. If it's done on the receiving machcine, it breaks scp
> transfers to that machine.

> why dont you use the scp command in the cron to copy files?
> 
> eg
> scp index.php [EMAIL PROTECTED]:/usr/local/apache/htdocs
> 
> usage is very simular to a nfs mount.
> 
> l8r,
> rod

The original problem was that this was, as far as I understood, exactly what
needed to be done. However, it also needed to be automated with a cron job,
and so, automatic autentication was neccesary. And since storing a password
or passphrase in plaintext is never ever clever, I suggested the method above.
It is not really fully secure, since you leave a loaded ssh-agent running and
anyone who has or gets root to the box can exploit and abuse it, but it's better
than storing the passphrase in a plaintext file.


-- 
Åsmund Skjæveland ([EMAIL PROTECTED])

PGP signature

Reply via email to