場景描述:
阿里雲服務器開啟配置了免密登錄,導致正常使用用戶名/密碼登錄的時候,提示公鑰等信息,拒絕訪問,
異常:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
處理方式:
---配置sshd_config:
vim /etc/ssh/sshd_config
(1) PermitRootLogin,將其修改為yes,即為允許root通過ssh進行連接
(2) 注釋掉Subsystem sftp /usr/libexec/openssh/sftp-server再加上一行
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
(3) PasswordAuthentication no
該參數默認啟用,默認值為 yes, 這里改回到yes。
(4)注釋掉:
RSAAuthentication yes
PubkeyAuthentication yes
PubkeyAuthentication yes
(5)放開注釋:
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
(6)重啟sshd服務:
systemctl restart sshd
systemctl status sshd.service #查看ssh服務的狀態