I have configured OpenSSH to use a specific key when I login to github....
[mpenning@mudslide .ssh]$ pwd
/home/mpenning/.ssh
[mpenning@mudslide .ssh]$ ls -la | grep config
-rw-r--r-- 1 mpenning mpenning 473 Jan 23 09:49 config
[mpenning@mudslide .ssh]$ head -n 4 config
Host gh
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github
[mpenning@mudslide .ssh]$
However, when I ssh to github without explicitly calling out github's private key on the CLI, authentication fails:
[mpenning@mudslide .ssh]$ ssh -F ./config [email protected]
Permission denied (publickey). ^^^^^^^^ This used to work
[mpenning@mudslide .ssh]$
The only way I can force it to work is to explicitly call out the private key when I ssh...
[mpenning@mudslide .ssh]$ ls -la | grep github
-r-------- 1 mpenning mpenning 3243 Nov 24 2016 id_rsa_github
-rw-r--r-- 1 mpenning mpenning 743 Nov 24 2016 id_rsa_github.pub
[mpenning@mudslide .ssh]$ ssh -i ./id_rsa_github [email protected]
PTY allocation request failed on channel 0
Hi mpenning! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
[mpenning@mudslide .ssh]$
My config
file worked yesterday... I haven't changed anything in it. The config
file already points to the correct private key.
Suddely, ssh seemingly ignores my github config. It never even tries the right private key...
[mpenning@mudslide .ssh]$ ssh -v [email protected] 2>&1 | grep github
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: Host 'github.com' is known and matches the RSA host key.
[mpenning@mudslide .ssh]$
Obviously this works, but I shouldn't have to use -i...
[mpenning@mudslide .ssh]$ ssh -i id_rsa_github -v [email protected] 2>&1 | grep github
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: identity file id_rsa_github type 1
debug1: identity file id_rsa_github-cert type -1
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Offering RSA public key: id_rsa_github
Authenticated to github.com ([192.30.253.113]:22).
Connection to github.com closed.
[mpenning@mudslide .ssh]$
My Questions:
- What broke this?
- How can I fix it?
ssh-agent
/ssh-add
.ssh-add
).