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 generated a key and copied it to my target:

ssh-copy-id username@hostname

I left the the location of the key as default and did not set any passphrase.

For a small while after that, I was able to ssh username@hostname without being prompted for a password, and then it stopped working for some reason.

share|improve this question
See unix.stackexchange.com/tags/ssh/info … Let's make this a reference question that we can close others as a duplicate of. –  Gilles Jul 19 '11 at 15:47

2 Answers 2

up vote 4 down vote accepted

If public key authentication doesn't work: make sure that on the server side, your home directory (~), the ~/.ssh directory, and the ~/.ssh/authorized_keys file, are all writable only by their owner. In particular, none of them must be writable by the group (even if the user is alone in the group). chmod 755 or chmod 700 is ok, chmod 770 is not.

What to check when something is wrong:

  • Run ssh -vvv to see a lot of debugging output. If you post a question asking why you can't connect with ssh, include this output (you may want to anonymize host and user names).
  • If you can, check the server logs, typically in /var/log/daemon.log or /var/log/auth.log or similar.
  • If public key authentication isn't working, check the permissions again, especially the group bit (see above).
share|improve this answer

The home directory of the target was 755 drwxr-xr-x. Changing it to be group-writable 775 drwxrwxr-x broke the password-less setup.

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.