I've been trying to set up Git over SSH and have followed the guides I've seen to the letter. I use ssh-keygen to create a key set, log into the remote host and append the public key to .ssh/authorized_users using cat id_rsa.pub >> .ssh/authorized_keys
. When I try to log in, I still get prompted for the user's (git user) password.
I also found a tutorial that showed how to use putty's keygen tool and followed that. Again, nothing. No variation of any tutorial I've found seems to get sshd on the remote host to allow me to log in with the generated key.
Is there any way to manually control this? I'm stuck on Red Hat Enterprise Linux 4 for now.
Make sure permissions are correct:
If you have access to the SSHd configuration you can check if
PubkeyAuthentication
is set toyes
to allow public key authentication. IfPubkeyAuthentication
is set tono
you will not be able to login with your public key and the server will prompt you for your password.If the user's home directory has group-write permissions, SSH will not permit public-key authentication, because otherwise any other member of the group could do the following and gain access to the user's account:
I see group-write home directories far, FAR too often. I've gone so far as to create a cron job to "chmod g-w" every homedir once an hour when the users have refused to heed my warnings.
Check the permissions on the authorized_keys file - 640 should be about right. SSH can be (rightly) picky about perms on these files and the .ssh directory which should be 755 at worst.
Did you check this setting in
sshd_config
?PubkeyAuthentication yes
Also check the permissions on .ssh and the private key .ssh needs to be 700 and the key 600.
Check for
AuthorizedKeysFile
in/etc/ssh/sshd_config
. Perhaps it is specifying an alternate location. The server'sauth.log
should tell you the reason for the authentication failure.root
access required.