Server Fault is a question and answer site for system and network administrators. 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


  • I add a ssh-key to the chain using ssh-add -K the_path as user@local
  • I set up key forwarding as described here
  • AllowAgentForwarding is enabled (local)
  • ForwardAgent is not "no" in /etc/ssh_config (remote)
  • echo "$SSH_AUTH_SOCK" delivers a tmp file (local)
  • when I ssh -vT as other@server then it logs in
  • When I run ssh-add -L as other@server then it adds the key.


  • When I run ssh-add -L on root@server then it says "Could not open a connection to your authentication agent."
  • When I run ssh -vT as root@server then it does not log in

I hardly don't know where to fix that or what the problem is. Can someone help?

share|improve this question
As per your linked document does the server have AllowAgentForwarding enabled? – Etan Reisner Jul 16 '13 at 6:33
Yes, it is in the sshd_config :) – Mike Pretzlaw Jul 16 '13 at 19:59

Sounds like you haven't started an ssh-agent session for your root user. ssh-agent requires your user to set env variables to associate your user with the correct ssh-agent process.


SSH_AUTH_SOCK=/tmp/ssh-MTQoMbTLN3Kb/agent.30851; export SSH_AUTH_SOCK; SSH_AGENT_PID=30852; export SSH_AGENT_PID; echo Agent pid 30852;

You may also want to look into SSHKeychain to make managing your agent and keys easier and automatic.

share|improve this answer
ForwardAgent is not enough for that? :/ Would it be a security issue on the server to have that running? I know it's needed but currently I want to "disable" root user and use another one. – Mike Pretzlaw Jul 16 '13 at 20:00

Using visudo and extending the env_keep with SSH_AUTH_SOCK will solve the problem

Defaults    env_keep+=SSH_AUTH_SOCK
share|improve this answer

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.