Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've been using public key authentication on a remote server for some time now for remote shell use as well as for sshfs mounts. After forcing a umount of my sshfs directory, I noticed that ssh began to prompt me for a password. I tried purging the remote .ssh/authorized_keys from any mention the local machine, and I cleaned the local machine from references to the remote machine. I then repeated my ssh-copy-id, it prompted me for a password, and returned normally. But lo and behold, when I ssh to the remote server I am still prompted for a password. I'm a little confused as to what the issue could be, any suggestions?

share|improve this question
1  
​​serverfault.com/questions/208181/… I'm not sure what StackExchange policy on duplicates across sites is, but it doesn't seem to me that cross-posting a question would be helpful. –  ephemient Dec 2 '10 at 7:04
    
If you've checked that only you can write to ~, ~/.ssh and ~/.ssh/authorized_keys, run ssh -vvv server.example.com and report the output (anonymize the host and user names if you want). If you have root access on the server, look at log entries created when you attempt a public key login. –  Gilles Dec 2 '10 at 19:56
add comment

3 Answers

sshd gets weird about permissions on $HOME, $HOME/.ssh (both directories) and on $HOME/.ssh/authorized_keys.

One of my linux boxes ended up with drwxrwxrwx permissions on my $HOME directory. An Arch linux box absolutely would not log in using public keys until I removed 'w' permission for group, other on my $HOME directory.

Try making $HOME and $HOME/.ssh/ have more restrictive permissions for group and other. See if that doesn't let sshd do its stuff.

share|improve this answer
1  
Yup. ssh-copy-id should have taken care of the permissions of ~/.ssh and ~/.ssh/authorized_keys, but also make sure that your home directory itself isn't group-writable. –  Gilles Dec 2 '10 at 19:59
2  
This was it, for me. I used ssh-copy-id to send over an RSA key, and I was still getting prompted. Running chmod g-w homedir on the remote server worked like a charm. –  Ben Kreeger Sep 28 '11 at 14:19
add comment

Does the problem occur also on parallel logins, i.e. if you try to mount sshfs while having an open ssh session? If not, then I would guess that you have your home directory encrypted? In this case $HOME/.ssh/authorized_keys would only become usable on the remote machine after your first login (using your password).

Check out https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Troubleshooting for an explanation and the required workaround.

share|improve this answer
add comment

Changing the permissions for the ~/.ssh folder solved my problem according to this post on Super User SE.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.