Hi,
You can use either:
1) expect + sftp + cron; or
2) use a Perl script
refer to http://www.linux-bsd-centr
Main Topics
Browse All TopicsI have a linux server and i need to download a file from our partner every two hours using sftp. I can manually do this, but since it's repetitious, i would like to automate it in a bash shell script. the problem i have is automatically logging in so that i don't have to enter a password on the command line. is there a way to pass in the password so that i don't need to type it in? i can even put in into the shell script encrypted so that it's not in the clear. I already have a tool that will encrypt / decrypt the password. I also cannot use ssh public/private keys since the partner does not want to get into the process of managing our public ssh keys.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
You can use either:
1) expect + sftp + cron; or
2) use a Perl script
refer to http://www.linux-bsd-centr
Exactly as slyong wrote - use expect (but you will have to use password in its plain form).
http://www.experts-exchang
I guess any programmer *should* avoid embedding root password in any script at all costs!!! This is a very very bad practice that nobody could object. I think the best solution would be the use of sftp (Secure file transfer over SSH) and the use of server key as authentication mechanism. Of course in this case the user should not be root and the key filne must be protected very well with user attributes and only the sftp would access and access would be denied to all other users.
Business Accounts
Answer for Membership
by: KeremEPosted on 2009-03-11 at 23:29:28ID: 23865318
Hi,
how_can _i_automat e_an_sftp_ transfer_b etween_two _servers.h tml
You can use login with a key instead of password. This way you dont need to embed any password in your script. To time it you can call it through cron script.
here's a link describes public/private key generation step-by-step:
http://ask-leo.com/
Cheers,
K.