歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> 解決ssh public key登錄彈出密碼輸入提示

解決ssh public key登錄彈出密碼輸入提示

日期:2017/3/1 16:18:03   编辑:關於Linux
解決ssh public key登錄彈出密碼輸入提示 os : centos 6.x 因磁盤空間不夠,將/home整個mount到一塊大硬盤上,之後發現不能用普通帳號ssh登錄了。新加的用戶也不能使用ssh登錄。root帳號一切正常。初步認定是掛載/home目錄時導致的權限問題。 調試步驟: use root account to execute chmod 755 /home 新建用戶test,在.ssh下添加authorized_keys,加入本機的public key。 useradd test chmod 700 /home/test su test cd mkdir .ssh chmod 700 .ssh add your public key to .ssh/authorized_keys chmod 600 .ssh/authorized_keys 用ssh -vvvT [email protected]嘗試登錄,查看/var/log/secure .... Jun 18 16:32:05 test sshd[1019]: debug1: trying public key file /home/test/.ssh/authorized_keys Jun 18 16:32:05 test sshd[1019]: debug1: restore_uid: 0/0 Jun 18 16:32:05 test sshd[1019]: Failed publickey for test from xx.xx.xx.xx port 36222 ssh2 好吧,登錄失敗。。。 查看/var/log/audit/audit.log,好吧,更悲劇,沒有記錄。。。(該問題沒搞定) 查看selinux 執行getenforce,狀態為Enforcing setenforce 0試試,再ssh -vvvT [email protected],成功了!那肯定和selinux有關了。把selinux改回來先:setenforce 1 maybe home directory is badly labeled,恢復一下/home目錄標簽試試 restorecon -R -v /home 再試試ssh -vvvT [email protected],成功了!搞定
Copyright © Linux教程網 All Rights Reserved