This page has been optimized for printing

Using your SSH Key (Linux/Mac)

This document assumes that you have already followed the steps in our guide Generating a SSH Key (Linux/Mac).

By now, you should have a public and private key on your computer, typically named `id_rsa` and `id_rsa.pub`, located in the `.ssh` directory. If you chose to use the default filename and path, SSH will automatically find and use this key when required, so no further action is necessary on your part. However, if you are using a nonstandard location or a key with a different name, you need to tell `ssh` which file to use. This can be done by using the following argument:

ssh -i /the/path/to/id_rsa

If you set a passphrase for your key, SSH will prompt you to enter it in order to decrypt the key for use. Entering the passphrase every time you use SSH can become tedious, but there is a solution. SSH includes a tool called an agent, which is a small program that runs in the background and handles authentication for SSH keys. You can load your SSH key into the SSH agent, and then it will be available for SSH to use. To do this, run the following command:

ssh-agent /the/path/to/id_rsa

After entering your passphrase (if you set one), the agent will start running and be ready for use. From this point onward, you can connect to your server using SSH without specifying the key file or entering the passphrase. The SSH agent will remain active until you close your terminal session.


More Information