I have checked many tutorials regarding this but not getting clearly.

As per tuts, there are two way to configure for agent forwarding

  1. in your config file ~/.ssh/config set

    Host example.com
    ForwardAgent yes
  2. By adding identity, like ssh-add.

What's use of it

  1. SSH Agent forwarding used to store key pass phrase. So that we don't need to enter pass phrase each time?

  2. Do we need two server to test SSH Agent Forwarding? Please suggest. Or we can test in with single server too?

I have checked this git hub link and followed same steps. I am able to see agent. when run this command echo "$SSH_AUTH_SOCK" Does that mean it's working?

How can I do it with my server? Please guide me.

UPDATE: When I trying to ssh, I am getting this error message in terminal

Agent admitted failure to sign using the key.


1) One way to use it is correct, the other is commandline argument -A.

2) Agent is storing pass-phrases for keys. Agent forwarding is for using local identities (with or without pass-phrase) on remote servers without the need to copy them into possibly unsafe environment.

3) You can test with one server, fur example localhost.

4) echo "$SSH_AUTH_SOCK" should verify it is set up, but doing ssh-add -L would verify it more reliably, because it will test the connection to agent.

  • Thanks for reply, Means we have to add key and ssh simply like with that added key? ssh username@servername.com and it will not ask you passphrase as it's store by agent? can we use servername=localhost? – Niks Aug 4 '15 at 9:56
  • ssh-add your-key to add your key to agent (it will ask for pass-phrase once), if it is alive. Then ssh server (with -A or config option) will not ask for pass-phrase and also other connection from should not ask from that host shouldn't ask for pass-phrase) – Jakuje Aug 4 '15 at 11:15
  • Thanks...Means if I set forward agent Yes in config file then I can ssh without use -A ? Please suggest. – Niks Aug 4 '15 at 11:43
  • hi.. When I ran command $SSH_AUTH_SOCK I am getting result as: -bash: /tmp/ssh-gT43vE99vk/agent.511: Permission denied I am confused here.. weather my agent forwarding working or not.. can you plz guide? also ssh-add -L with this it listing SSH key I added. please suggest me. – Niks Aug 8 '15 at 6:37
  • there is no "running command $SSH_AUTH_SOCK". It is environment variable which contains path to unix domain socket and you can't obviously run it. But ssh-add can communicate with your agent through this socket. I wrote echo "$SSH_AUTH_SOCK" which verifies you that the variable is set. – Jakuje Aug 8 '15 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.