I'm working as a programmer at the moment, and as a result need to constantly upload my software to remote systems for testing. I have about 7 machines which need to receive copies of everything.

At the moment, I have a short bash script with a scp performing the transfer for each remote machine:

echo -e "\nUpdating Taiwan Machine"
scp {file1,file} bschlinker@taiwan:/home/bschlinker/
echo -e "\nUpdating Wisconsin Machine"
scp -P 2400 {file1,file2} bschlinker@wisconsin:/home/bschlinker/

I'm painfully prompted for the password to each machine. I recognize I can solve this with SSH keys -- but I don't want to have passwordless authentication to the remote machines via the key. As a result, I have a passphrase set on my SSH key. I read that after entering your passphrase once, it will remain active for the rest of the current terminal session. Is that true? If not, any ideas?


If you have a SSH agent running (such as the cleverly-named ssh-agent) then you can add the key to the agent and the SSH client will communicate with the agent to get the key from it.

  • +1 for linking to an article about keychain - anyone who uses ssh should use keychain... – James Jun 29 '10 at 23:02
  • 2
    I don't use keychain. Never had a need for it. – Ignacio Vazquez-Abrams Jun 29 '10 at 23:19

You need SSH-AGENT for this. Then, depending on your OS, you can configure it to start running when you log-in and prompt you for passphrase. Afterwards, as long as you are logged in, it will provide ssh sessions with your keys.

SSH-AGENT also does something more clever - if you ssh to one machine and from that machine ssh on to a third server on which you also have your public key, the second machine will also get automatically authenticated through the agent (its called agent forwarding).

  • Forwarding only happens with ssh -A IIRC. – Andrew Jun 29 '10 at 23:08
  • Thats one possibility. The other is setting it in the config file. Some clients do this automatically (Putty, I think). – chenshap Jun 30 '10 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.