I added the public SSH key to the authorized_keys file. ssh localhost
should log me in without asking for the password.
I did that and tried t
I issued sudo chmod 700 ~/.ssh
and chmod 600 ~/.ssh/authorized_keys
and chmod go-w $HOME $HOME/.ssh
from a previous answer and it fixed my problem on a CentOS 7 box that I had messed up the permissions on while trying to get Samba shares working.
The thing that did the trick for me finally was to make sure that the owner/group were not root, but user:
chown -R ~/.ssh/ user
chgrp -R ~/.ssh/ user
Beware that SELinux can trigger this error as well, even if all permissions seem to be OK. Disabling it did the trick for me (insert usual disclaimers about disabling it).
It seems like a permission problem. Usually it happens if the permission of some file/directory is not correctly set up. In most case they are ~/.ssh
and ~/.ssh/*
. In my case they are /home/xxx
.
You can change the log level of sshd by modifying file /etc/ssh/sshd_config
(search for LogLevel
, and set it to DEBUG
) and then check the output in file /var/log/auth.log
to see what happened exactly.
Another tip to remember: Since v7.0 OpenSSH disables DSS/DSA SSH keys by default due to their inherit weakness. So if you have OpenSSH v7.0+, make sure your key is not ssh-dss
.
If you are stuck with DSA keys, you can re-enable support locally by updating your
sshd_config
and~/.ssh/config
files with lines like so:PubkeyAcceptedKeyTypes=+ssh-dss
This solves my problem:
ssh-agent bash
ssh-add