19

I created ssh key. I use it to connect with git repositories. When creating the key, I noticed the prompt that said the password should be hard to guess. Therefore, I came up with 40+ characters-long password. Now, every time I do git clone, push or anything similar, I need to input the password(which takes some time, especially when I don't get it right).

I certainly am glad that I'm enjoying security features; however, I'd prefer for ssh password to cache for 5-15 minutes(or any other arbitrary amount); sometimes I do many operations on repository in small time frame, and typing password is taking too much time. How can I do this?

  • 1
    If possible, switch to using public key authentication. In this scheme, the private key (which you need to create along with the public key) never leaves your computer. You can protect it with a password, but it can be a shorter password because (if you take reasonable security measures on your computer) it's more difficult for an attacker to get the private key in the first place. – David Z Mar 22 '16 at 12:31
24

You can do this using an SSH agent. Most desktop environments start one for you; you can add your key to it by running

ssh-add

If you need to start the agent, run

eval $(ssh-agent)

(this sets up a number of environment variables).

The -t option to ssh-agent will allow you to specify the timeout. See Configuring the default timeout for the SSH agent for more details.

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.