Ssh – How to enable key forwarding with ssh-agent

forwardingpublic-keysshssh-agent

I've used the ssh-agent from oh-my-zsh to manage my SSH key. So far, so good, i only have to type the passphrase for my private key once when I start my shell and public key authentication works great.

The problem is however that key forwarding doesn't work. There are 2 servers A & B which I can use public key to login. When I ssh into A then from there ssh into B, I must provide my password, which should not be the case.

A is a CentOS 5.6 box, B is an Ubuntu 11.04 box. I have this on my local .ssh/config:

Host *
    ForwardAgent yes

OpenSSH on A is standard openssh 4.3 package provided by CentOS. I also enable ForwardAgent for ssh client on A, but forwarding still doesn't work.

Best Answer

Make sure AllowAgentForwarding is set to yes on the servers (sshd_config).

My guess is you are missing that.

Also forwarding is only on openssh 5.1+ So make sure you are running a valid version