Cache your SSH Passphrase on Linux

This blog post will show you how to cache your SSH private key passphrase for the duration of the shell and not being asked to provide it.

Using SSH keys for authentication is great and very secure; however, if you have a passphrase on your key, you might be annoyed retyping it every time you would like to use it. This option will stop it from asking you for the password.


The first step in this process is to ensure the SSH agent service is running on your machine. To check if it is running, run the following command, which will start it.

eval $(ssh-agent)

Cache SSH Passphrase

To cache an SSH passphrase, we need to run the following command against the key we would like to cache, as shown below.

ssh-add ~/.ssh/id_rsa 

Once you run the command, you will not be asked to provide the passphrase password for the duration of the entire session. To remove a passphrase from an SSH us this blog post.

Success! You're on the list.