Ssh – Remember password for ssh key for some time

gitssh

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?

Best Answer

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.

Related Question