Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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

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

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

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

share|improve this answer
However, be aware of possible security issues with using SSH agent forwarding: There's a reason why they are disabled by default, and they should only be enabled for trusted hosts/networks. – Riccardo Murri Oct 13 '10 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 '10 at 18:18
that option doesn't seem to be supported for this version of ssh (10.04) – Rob Oct 13 '10 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 '10 at 18:42
Yes, that is the correct option. thanks. – Rob Oct 13 '10 at 18:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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