Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to script file transfers between two servers. Local server is RHEL 5.x. Remote location uses two-factor authentication (key+password). Authenticates fine on the key-pair but I can't find syntax that would allow me to relay the password.

Command example that partialy works:

sftp -oIdentityFile=<path_to_ssh_key> <un>@<site>

SCP is apparently a possibility, but the remote location apparently doesn't have anyone who uses it so future support might be shallow.

Anything else I can try?

share|improve this question
Have you looked into expect before? You can basically set it up to watch for a specific return, and then send the password. Since it integrates well into scripts, you could store the password in an encrypted file and decrypt only when needed (using GPG) – nerdwaller Jan 10 '13 at 20:12

You must log in to answer this question.

Browse other questions tagged .