Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

买的新的腾讯云服务器报错:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

详细如下:

# [cdh02 root 19:44:00] [Tue Mar 16] /data/software
$ ssh cdh01
The authenticity of host 'cdh01 (172.21.64.11)' can't be established.
ECDSA key fingerprint is SHA256:d6/hLeY+XejgRxZSDpsUrCMfOLPCz/JGsCV8H2RMK/k.
ECDSA key fingerprint is MD5:be:76:80:11:c5:0c:62:fa:9e:33:b6:c1:18:6b:83:a8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'cdh01,172.21.64.11' (ECDSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

解决办法:

sudo vim /etc/ssh/sshd_config
增加如下修改
PasswordAuthentication yes


sudo systemctl restart sshd

如果你喜欢用root用户登入的话,要确保:

/etc/ssh/sshd_config

PermitRootLogin yes

免密登陆实际上就是将你本机的公钥添加到authorized_keys文件中

~/ssh/authorized_keys

id_rsa 是私钥,id_rsa.pub 是公钥:

# [cdh02 root 19:55:16] [Tue Mar 16] ~/.ssh
$ ll
total 16
-rw------- 1 root root  799 Mar 16 16:52 authorized_keys
-rw------- 1 root root 1679 Mar 16 19:13 id_rsa
-rw-r--r-- 1 root root  392 Mar 16 19:13 id_rsa.pub
-rw-r--r-- 1 root root  360 Mar 16 19:55 known_hosts

参考: https://blog.csdn.net/albertjone/article/details/84946557

上一篇:《Ultra Fast Structure-aware Deep Lane Detection》论文笔记


下一篇:20.3. Authentication Methods