Frequently Asked Questions

Troubleshooting ssh-agent
Last Updated 8 days ago

If you have trouble with adding the key to your agent and forwarding it, it may be that ssh-agent is not running, or your key is not added correctly.

Check if it is running:

$ ps -aux | grep ssh-agent

If its running already, the output will look something like this:

501 943 1 0 9:34PM ?? 0:01.26 /usr/bin/ssh-agent -l

Starting ssh-agent
If ssh-agent is not running, you can start it like this:

$ ssh-agent > agent_variables.tmp

$ source agent_variables.tmp

You will see an output from the last step like "Agent pid ". then do:

$ rm agent_variables.tmp

What you are doing in these steps is starting the agent and importing some necessary environmental variables to use with it. If you had just typed ‘ssh-agent’ without directing the output to a file, you would see something like this:

SSH_AUTH_SOCK=/tmp/ssh-N2O3IxWPoczq/agent.4328; export SSH_AUTH_SOCK;


echo Agent pid 4329;

SSH_AUTH_SOCK and SSH_AGENT_PID are the variables you need to add to your environment to use the agent. You could copy and past these two lines to the command line to do that.

Adding your key
After starting ssh-agent, you will need to add your key:

$ ssh-add ~/.ssh/

If your key has a default name like id_rsa, it is usually added automatically when the agent starts, but if you gave it a different name you will have to add it again every time the agent restarts. You can always check if your key is added like this:

$ ssh-add -l

4096 SHA256:CBC6QYABDmr8vG5EQE+n7vvPIM5USVv1iTWgM9/ZMJ4 .ssh/cloud_key (RSA)

Above, we see that cloud_key is added.

Checking your agent forwarding
If after connecting to the first VM, you find that your key doesn’t seem to be logging you into another VM from there, you can check that your agent is forwarded by typing:


from the first VM. The output should look like:


If it is blank, it means your key is not forwarded. Did forget to type -A?

If the agent is forwarded, but your key still doesn’t work, use the instructions above to check that the correct key is added to the agent.

Please Wait!

Please wait... it will take a second!