Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
​​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

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
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
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

The following permissions are needed:

  • The .ssh folder: 700 (drwx------)
  • The public key: 644 (-rw-r--r--)
  • The private key: 600 (-rw-------)
share|improve this answer

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

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

share|improve this answer

I recently experienced this issue as well.

It was corrected by modifying the permissions of the $HOME directory. However, simply running chmod g-w ~/ did not correct the issue. In addition to chmod g-w ~/ I also needed to modify the permissions of others on the $HOME directory by running chmod o-wx ~/


chmod g-w ~/
chmod o-wx ~/

Do note that I am not sure if o-x was necessary, I simply ran it as a precaution.

share|improve this answer

Your Answer


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.