- Start ssh-agent
#local
eval `ssh-agent -s`
- Add identity
ssh-add
- Configure ssh forwarding
# local
cat "
Host github.com
ForwardAgent yes
" >> .ssh/config
- Add public key to server2
ssh-copy-id user@server2
- SSH login server2 in server1 with passwd
#first, pls login server1, then execute follow command
ssh -T user@server2 #yeah!, you can login.