Friday 21 February 2014

Bad file permissions prevent SSH access to Github

You might be trying to access GitHub from the Windows command line, but get the message "Could not open a connection to your authentication agent.":

$ ssh-add ~/.ssh/id_rsa

Could not open a connection to your authentication agent.



$ eval 'ssh-agent -s'

SSH_AUTH_SOCK=/tmp/ssh-z8CtJ8nsSdBL/agent.6724; export SSH_AUTH_SOCK;

SSH_AGENT_PID=6672; export SSH_AGENT_PID;

echo Agent pid 6672;



$ ssh-add ~/.ssh/id_rsa

Could not open a connection to your authentication agent.



$ eval "$(ssh-agent)"

Agent pid 6500


$ ssh-add ~/.ssh/id_rsa

Identity added: /c/Users/username/.ssh/id_rsa (/c/Users/username/.ssh/id_rsa)



$ ssh -vT git@github.com

Permission denied (publickey).

$ cd .ssh

~/.ssh $ ls

AGAIN      github_rsa      key      known_hosts  new_key.pub

AGAIN.pub  github_rsa.pub  key.ppk  new_key

Here's the real problem: the file permissions on the key files are wrong.


~/.ssh $ chmod 700 id_rsa

~/.ssh $ cd ..

~ $ ssh -vT git@github.com

Enter passphrase for key '/c/Users/Roderick/.ssh/id_rsa':

Hi username! You've successfully authenticated, but GitHub does not provide she

ll access.

debug1: channel 0: free: client-session, nchannels 1

debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.2 seconds

debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0

debug1: Exit status 1



No comments:

Post a Comment