CentOS 7.6出現SSH登錄失敗的解決方法


CentOS 7.6出現SSH登錄失敗的解決方案

問題重現:

iterm登錄

ssh vagrant@192.168.10.10
The authenticity of host '192.168.10.10 (192.168.10.10)' can't be established.
ECDSA key fingerprint is SHA256:8nyfIaEq9jMHfb9aQIlPh5OAGXjjSVGEDiXfMjlD7H8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.10' (ECDSA) to the list of known hosts.
vagrant@192.168.10.10: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

sshShell登錄

>   11:06:29 Connecting to 192.168.10.10 port 22
>   11:06:29 Command: ssh -p 22 vagrant@192.168.10.12
>   11:06:29 Connect to 192.168.10.12:22, with timeout 15.000000
>   11:06:29 Create socket with IPv4 address family
>   11:06:29 Socket is connected successfully
>   11:06:29 Client banner: SSH-2.0-libssh_0.7.5
>   11:06:29 Server banner: SSH-2.0-OpenSSH_7.4
>   11:06:29 Negotiated with server
>   11:06:29 Authentication that can continue: publickey, gssapi-with-mic
>   11:06:29 Disconnected from server

解決辦法

1、卸載重新

[root@cent ~]# yum -y remove openssh-server
[root@cent ~]# yum -y install openssh-server

2、生成密鑰(可選)

[root@cent ~]# sshd-keygen

3、修改sshd_config配置文件

[root@cent ~]# vim /etc/ssh/sshd_config
# 添加以下內容至文件末尾處 :wq
PubkeyAuthentication yes

4、重新啟動sshd

[root@cent ~]# systemctl restart sshd.service


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM