# Automatic sftp/ssh



## WhateverJoe (Sep 10, 2002)

I've asked this many moons ago... but I have yet to figure it all out and do it...

But simply, I would like to have one of my systems sftp to onther and grab a file at set times via a crontab entry...

I have been having no luck and pure frustration trying to setup either host based or private key base non-interactive logon .. so I can use a batch file for sftp with out my input for authentication...

Any help would be greatly, and I mean greatly appreciated !

Thanks,


----------



## WhateverJoe (Sep 10, 2002)

OK... sometimes I'm a real idiot....

every time I came back to this issue trying to do it... I always entered a passphrase when generating a key via ssh-keygen ...

So now I know my stupid mistake on that part...

and have gotten it to work as long as the usernames are matched on both ends... but how do I do this with two different usernames?


----------



## hgreenfi (Sep 11, 2002)

Unless you must use sftp you might want to give scp a try.  Assumeing that you have your ssh-keys set up so that logging on to your remote box doesn't require a password the following command should work as a cron entry.

"scp remoteUserName@remoteHostName:/path/to/file /path/to/local/file"

This is how I transfer files from various systems on which I have different user names, I have my ssh-keys set up so that I don't need a password, but I have never needed to run it as a cron job.  Good luck and let me know how it goes.


----------

