Bitbucket SSH Authentication

I have a problem with my SSH service,

ssh-agent is running:

ps -e | grep ssh

12163? 00:00:00 ssh-agent

and caches my only identification:

ssh-add -l

4096 25: 56: f4: 9c: 09: 65: fe: 39: b3: 17: 73: bd: 3c: 76: 3f: 8d / home / matthias / .ssh / id_rsa (RSA)

everything exists as it should:

ls ~ / .ssh /

id_rsa id_rsa.pub known_hosts

and id_rsa.pub is loaded into the Bithucket.org SSH-Keys section.

However, SSH authentication failed (using verbose mode, you can see that it is somehow trying to load the non-existent id_dsa file)

ssh -v -T hg@bitbucket.org
[...]
debug1: Next authentication method: publishing
debug1: Providing the RSA public key: /home/matthias/.ssh/id_rsa
debug1: authentication that can be continued: publickey
debug1: Providing the RSA public key: /home/matthias/.ssh/id_rsa
debug1: Remote: forced command: conq username: matthias_hueser
debug1: Remote: port forwarding disabled.
debug1: Remote: X11 forwarding is disabled.
debug1: Remote: agent forwarding disabled.
debug1: Remote: Pty highlighting is disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: key_parse_private_pem: PEM_read_PrivateKey failed debug1: read PEM private key: type
Enter the passphrase for the key '/home/matthias/.ssh/id_rsa':
debug1: read PEM private key: enter RSA
debug1: Remote: forced command: conq username: matthias_hueser
debug1: Remote: port forwarding disabled.
debug1: Remote: X11 forwarding is disabled.
debug1: Remote: agent forwarding disabled.
debug1: Remote: Pty highlighting is disabled.
debug1: authentication that can be continued: publickey
debug1: using the private key: /home/matthias/.ssh/id_dsa
no such identifier: /home/matthias/.ssh/id_dsa: No such file or directory
debug1: using the private key: /home/matthias/.ssh/id_ecdsa
no such identifier: /home/matthias/.ssh/id_ecdsa: No such file or directory
debug1: There are no more authentication methods.
Permission denied (publickey).

Does someone else have the same problem and have a suggestion?

[Thanks for editing]

+4
source share
1 answer

The result you see is consistent with the server rejecting your id_rsa key. ssh will check id_rsa , id_dsa and id_ecdsa , even if you do not specify them on the command line or load them into your ssh-agent.

If I fixed this problem, I would remove ssh-agent from the image and set your secret key on the command line.

Run this in a new shell that you close later so that you do not destroy the existing environment:

 $ bash $ unset SSH_AGENT_PID SSH_AUTH_SOCK $ ssh -v -T -i ~/.ssh/id_rsa hg@bitbucket.org [...] $ exit 

(ssh-keygen should ask for a password for your key)


If this works, I would double check that the key that your ssh agent provides is actually correct. You can

 $ ssh-keygen -y -f ~/.ssh/id_rsa 

And check that against your ssh-agent:

 $ ssh-add -L 

If the identifier in your agent is different, you must reset your keys with ssh-add -D and reload them. If it is not, I am not sure what. Hope this helps.

+1
source

All Articles