This page has been optimized for printing

Using your SSH Key (Linux/Mac)

This document assumes 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, likely named `id_rsa` and `id_rsa.pub` in the `.ssh` directory. If you opted to use the default filename and path, ssh will just find this key and use it when it's requierd, no further action on your part is required. However if you are using it in a non standard location you will need to tell `ssh` which file to use. This is simply done with the following argument:

ssh -i /the/path/to/id_rsa

If you opted to use a passprhase SSH will now prompt for it so that it can decrypt the key for use. If you are doing a lot of work in a terminal it can get tedious typing this password in continually, but there is a solution. SSH also comes with a tool called an Agent, this is a small program that runs in the background with the sole job of authenticating access to servers using SSH keys. You are able to load your ssh key into the ssh agent, after which it will be available to ssh. To do this run the following command:

ssh-agent /the/path/to/id_rsa

After entering your password (if you used one) the agent will now be running and ready for use, you may then simply connect to your server using ssh without specifying either the file or the password. The ssh agent will only be active until you close your terminal session.


More Information