Server Fault is a question and answer site for system and network administrators. 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'm connecting to a SSH server with a key file that has a passphrase. How can I make ssh stop asking for passphrase and always use the correct passphrase?

share|improve this question
up vote 6 down vote accepted

Obviously you have to provide the correct passphrase at least once.

take a look at keychain for "storing" the passphrase bound to the private key. Keychain uses the ssh-agent for accessing the keys.

I use this line in my shell startup script:

eval `keychain --eval --nogui -Q -q .ssh/id_rsakey`

Therefore I have to provide the passphrase once the shell starts, and it is stored for the whole login process. ssh-agent should be running, of course, in my case it is started via .xinitrc

share|improve this answer

You can use ssh-agent to remember the passphrase for you. There's a nice guide on how to do this up on github:

share|improve this answer

The key is stored in a "locked" state, and is unlocked by your passphrase every time you want to use it. You can create a key without a passphrase (not recommended), or most operating systems allow you to unlock the key for a certain period of time, or even from login.

Which OS are you using?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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