The following would show a similar output if a key is already added to your agent, and you are good to go.
$ ssh-add -l
2048 d7:8e:3d:03:9c:4f:f8:9d:04:0f:11:c5:24:e1:2f:3a rsa w/o comment (RSA)
The following will show if no agent is running.
$ ssh-add -l
Could not open a connection to your authentication agent.
If no agent is running execute the following.
$ eval `ssh-agent`
If the agent is running but no identities.
$ ssh-add -l
The agent has no identities.
If an agent is running run the following.
$ ssh-add
The above example assumes that you already generated your ssh-key.
$ ssh -A -i <your_pemfile> user@<remote_addr>
The -A
flag enables forwarding of the authentication agent.
Once you logged inside your remote server just run the following to check if ssh forwarding agent is enabled:
$ echo "$SSH_AUTH_SOCK"
/tmp/ssh-DCIux21917/agent.21917
If the variable is not set then the forwarding agent is not working.
- Handling ssh-agent across multiple terminal sessions locally