I've followed Bitbucket's instructions to add my SSH keys and use git without having to authenticate each time. I followed the instructions here. Then I get to ssh -T git@bitbucket.org
I get the following message:
Bad owner or permissions on /home/centos/.ssh/config
A check of the SSH permissions shows:
cat ~/.ssh/config
Host bitbucket.org
IdentityFile ~/.ssh/id_rsa
And ~/.ssh/id_rsa
exists and contains my private key. The public key is already added to my SSH keys in Bitbucket and the error message I get is not in their troubleshooting guide.
System is CentOS Linux release 7.0.1406 (Core), git version 1.8.3.1, the SSH key was added to Bitbucket 5 hours ago. Not sure if relevant, the user centos
on the CentOS machine was automatically created and I log in using an identity file (I don’t have a password for it). Also, the Bitbucket repository is working fine and I can work with it from another computer no problem. Both SSH keys are listed under my Bitbucket account.
UPDATE: Both answers I got mention permissions but that I had already checked. Both ~/.ssh/id_rsa
and ~/.ssh/id_rsa
are owned by my user with 664
and 600
respectively. I even tried chmod 777
to both files but got the same message.
Best Answer
777
permissions will never work. SSH permissions are highly restrictive and opening them up more like that will only cause errors. Also your comments to other questions state that these are your current permissions:Those are
664
permissions which are-rw-rw-r--
. What you want is600
permissions which would be-rw-------
. So please try this; first change the~/.ssh/config
permissions like this:Now do the same for
~/.ssh/id_rsa
Also, I am not too sure what the Bitbucket SSH domain/user combo would be but it might be worth it to debug the process by using the SSH command with the
-v
(verbose) flag to see in detail what is happening. A command like this would help:The
-v
would be the verbose output and the-T
would be setting SSH to “disable pseudo-tty allocation” so it would not be creating a real interactive session; it will essentially just attempt to connect to the remote host and then drop the connection. Useful for testing.