Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH Agent Forwarding not working

I'm having an hard time trying to configure Capistrano 3.1 to deploy an app hosted on Github.

I'm following Capistrano Documentation and I have successfully completed the first step (SSH keys from workstation to servers) and on the second one (From our servers to the repository host) I'm able to successfully run ssh -A [email protected] 'git ls-remote [email protected]:my_user/my_repo.git':

18f38afz261df35d462f7f4e2ca847d22f148a06    HEAD 18f38afz261df35d462f7f4e2ca847d22f148a06    refs/heads/master 

however, ssh [email protected] 'git ls-remote [email protected]:my_user/my_repo.git' fails:

Permission denied (publickey). 

Capistrano docs suggests

If you get the error "host key verification failed." log in into your server and run as the deploy user the command ssh [email protected] to add github.com to the list of known hosts.

SO, I tried so but I get

ssh [email protected] Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts. Permission denied (publickey). 

And I'm basically not able to successfully access the Github repo.

SSH documentation states:

-A      Enables forwarding of the authentication agent connection.  This          can also be specified on a per-host basis in a configuration          file. 

How can I specified on a per-host basis in a configuration file?

My local machine runs Mac OSX Mavericks. The VPS runs Ubuntu 12.04

Thanks.

like image 865
Sig Avatar asked Feb 03 '14 07:02

Sig


People also ask

How do I forward an SSH agent?

From the configuration, go to Connection > SSH > Auth and enable “Allow agent forwarding.” You can also add your private key file from the same pane. PuTTY will handle the SSH agent for you, so you don't have to mess around with any config files.

How does SSH forwarding work?

Dynamic port forwarding allows you to create a socket on the local (ssh client) machine, which acts as a SOCKS proxy server. When a client connects to this port, the connection is forwarded to the remote (ssh server) machine, which is then forwarded to a dynamic port on the destination machine.

How do I know if SSH is forwarding enabled?

To test that agent forwarding is working with your server, you can SSH into your server and run ssh -T [email protected] once more. If all is well, you'll get back the same prompt as you did locally.

Is SSH agent forwarding safe?

Agent forwarding comes with a risk When you forward ssh-agent 's Unix domain socket to a remote host, it creates a security risk: anyone with root access on the remote host can discreetly access your local SSH agent through the socket. They can use your keys to impersonate you on other machines on the network.


1 Answers

Do you have your ssh key added to the list of agent identites ?

You can check with ssh-add -L , you should see the key your are using to connect to github :

$ ssh-add -L ssh-rsa AAAAB3N.....0VmSiRvTzBrbU0ww== /Users/youruser/.ssh/id_rsa 

If you don't see the ssh key you use for github or a message like

The agent has no identities.

Then you should add your key with :

ssh-add ~/.ssh/id_rsa 

(replace with the path to the key you use for github)

See the ssh-add doc for more info

like image 122
vdaubry Avatar answered Sep 22 '22 21:09

vdaubry