Adding a public key to ~/.ssh/authorized_keys does not log me in automatically

前端 未结 30 2630
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 03:15

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

30条回答
  •  余生分开走
    2020-12-02 03:45

    SELinux can also cause authorized_keys not to work. Especially for root in CentOS 6 and 7. There isn't any need to disable it though.

    Once you've verified your permissions are correct, you can fix this like so:

    chmod 700 /root/.ssh
    chmod 600 /root/.ssh/authorized_keys
    restorecon -R -v /root/.ssh
    

提交回复
热议问题