3

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?

BSchlinker
  • 340
  • 2
  • 3
  • 12

2 Answers2

7

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.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
3

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).

chenshap
  • 146
  • 4