Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Situation

  • 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 https://help.github.com/articles/using-ssh-agent-forwarding
  • 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 git@bitbucket.com as other@server then it logs in
  • When I run ssh-add -L as other@server then it adds the key.

Problem

  • 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 git@bitbucket.com 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

2 Answers 2

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

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.

e.g

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

Your Answer

 
discard

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.