When I SSH into my firewall server, then attempt to ssh into another machine on the local network from there I get the following error:

Could not open a connection to your authentication agent.

Is there a way that I can have the agent run correctly from within another SSH session?

2 Answers 2


Yes. you can enable agent-forwarding by adding

ForwardAgent Yes

in your ssh configuration file (either ~/.ssh/config for user or /etc/ssh/ssh_config system wide.

See also http://drupal.txwikinger.me.uk/content/configurations-ssh-make-some-things-more-convenient.

Alternatively, if ssh is called with the option -A, the agent forwarding is also enabled as pointed out in the other answer.

  • However, be aware of possible security issues with using SSH agent forwarding: unixwiz.net/techtips/ssh-agent-forwarding.html#sec There's a reason why they are disabled by default, and they should only be enabled for trusted hosts/networks. Oct 13, 2010 at 16:22
  • This is not a problem of enabling AgentForwarding. This is a problem of access to a private key via a unix socket.
    – txwikinger
    Oct 13, 2010 at 18:18
  • that option doesn't seem to be supported for this version of ssh (10.04)
    – Rob
    Oct 13, 2010 at 18:39
  • Sorry. I think I did some wrong pasting. I have corrected it. I use this with 10.04 and 10.10 without any problems.
    – txwikinger
    Oct 13, 2010 at 18:42

I addition to what txwikinger said, you can also just use the -A command line option when SSHing to your firewall.

  • This works, thanks. Do you know what the correct option is to make this a default in .ssh/config?
    – Rob
    Oct 13, 2010 at 18:41
  • Add ForwardAgent yes to the .ssh/config for that Host to default to the -A flag
    – Rob
    Oct 13, 2010 at 18:44
  • You can also try this "eval ssh-agent".
    – Marky
    Dec 4, 2012 at 3:45

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.