1. 程式人生 > >SSH打通密鑰後仍需要密碼

SSH打通密鑰後仍需要密碼

Linux SSH 密鑰

其他原因導致的此問題:
一、配置文件sshd_config需要設置

        vim /etc/ssh/sshd_config
        RSAAuthentication yes  
        PubkeyAuthentication yes  
        AuthorizedKeysFile      .ssh/authorized_keys 
   重啟SSH服務 

二、文件權限問題

       chmod  700 ~/. ssh /
       chmod  700 /home/userName  
       chmod  600 ~/. ssh /authorized_keys

如果非上述原因導致的SSH打通密鑰仍需要密碼登陸,在需要查看日誌/var/log/secure

例如此類報錯:Authentication refused:bad ownership or modes for directory /root

則需要查看/root/ 目錄權限,確保宿主用戶為root

修復方法:chown root:root -R /root

SSH打通密鑰後仍需要密碼