Macos – How to do SSH agent forwarding on Mac terminal

macossshssh-agentsshdterminal

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.

Best Answer

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.

Related Question