Mastodon

Unlocking ssh private key per shell session

When you have a password protected ssh private key, you need it to be unlocked every time you want to use the it for authentication purpose.  This leads to password prompts every time the private key is been used.  If you want this to be avoided for the current shell session then below combination of command will help you achieve that.

$ eval `ssh-agent -s`
$ ssh-add <absolute path to the private key>

Once added, until you logout from the current shell where the ssh-agent is running, you wont be prompted to unlock the private key again.

Very handy for a long running linux pc / server.