通過(guò)SSH客戶端登錄Linux實(shí)例時(shí)提示“Permission denied, please try again”錯(cuò)誤怎么辦?
通過(guò)SSH客戶端登錄Linux實(shí)例時(shí)提示“Permission denied, please try again”錯(cuò)誤怎么辦?
問(wèn)題描述
過(guò)本地SSH客戶端登錄Linux系統(tǒng)的ECS實(shí)例時(shí),即便輸入了正確的密碼,出現(xiàn)了類似如下的錯(cuò)誤信息。
問(wèn)題原因
導(dǎo)致該問(wèn)題可能有以下原因:
ECS實(shí)例內(nèi)禁用root用戶登錄:SSH服務(wù)對(duì)應(yīng)配置文件/etc/ssh/sshd_config中的參數(shù)PermitRootLogin或PasswordAuthentication被設(shè)置為no。您可以參考禁止root用戶登錄引起問(wèn)題的解決方法解決。
Linux系統(tǒng)啟用了SELinux服務(wù),導(dǎo)致root用戶和普通用戶無(wú)法登錄。
執(zhí)行cat /var/log/secure查看secure日志,若日志中包含error: Could not get shadow infromation for root.表示是啟用了SELinux服務(wù)導(dǎo)致
禁止root用戶登錄引起問(wèn)題的解決方法
· cat /etc/ssh/sshd_config

vi /etc/ssh/sshd_config
# 如果需要root用戶登錄,請(qǐng)將PermitRootLogin參數(shù)值設(shè)置為yes
# 如果需要密碼方式登錄,請(qǐng)將PasswordAuthentication參數(shù)值設(shè)置為yes。
# 更改后保存退出

SELinux服務(wù)引起問(wèn)題的解決方法
/usr/sbin/sestatus -v
# 系統(tǒng)顯示類似如下
SELinux status: enabled