Automating SSH and FTP

Automating SSH Login

SSH is generally happy accepting a hash key instead of username and password, provided you can generate your keys, and get your public key placed on the destination host. What’s ironic here is that doing things the “simple” way in Windows, in a GUI, is actually kind of elaborate, while doing it the “hard” way from the command line in Linux or Unix is pretty darn easy.

If you’re stuck on the Windows side, Leo Notenboom (“Ask Leo!”) has a nice guide to generating your keys using various GUI tools at
http://ask-leo.com/how_do_i_create_and_use_public_keys_with_ssh.html.

If you are working in Linux you can directly specify RSA or DSA keys as part of your keygen command. A truly fine example using DSA by Vivek Gite is at
http://www.cyberciti.biz/faq/ssh-password-less-login-with-dsa-publickey-authentication/

Automating FTP Transfers

And Leo has a more advanced how-to at
http://ask-leo.com/how_can_i_automate_an_sftp_transfer_between_two_servers.html.

Notice in all of this that Leo suggests using no passphrase, while Vivek shows a more sophisticated solution.

CAVEAT: see what actually works on your target system!