微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ssh连接报错

使用ssh远程连接服务器时报错解决方
报错一:在使用ssh 公网ip地址时

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone Could be eavesdropping on you right Now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:APAQekG1WkP/2VYkQb42IpqvP74VHklIsaZyKiFSOYs.
Please contact your system administrator.
Add correct host key in /home/saber/.ssh/kNown_hosts to get rid of this message.
Offending ECDSA key in /home/saber/.ssh/kNown_hosts:1
  remove with:
  ssh-keygen -f "/home/saber/.ssh/kNown_hosts" -R "8.219.56.85"
ECDSA host key for 8.219.56.85 has changed and you have requested strict checking.
Host key verification Failed.

解决方法:ssh_keygen -R 公网ip地址
报错二:ssh 公网ip地址

The authenticity of host '8.219.56.85 (8.219.56.85)' can't be established.
ECDSA key fingerprint is SHA256:a4sRHxyVsWzmfkXhP2SFBTvthkmswLELmSs/8doUI0c.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

解决办法:修改本地机与服务器的ssh.config文件,将修改为StrictHostKeyChecking ask注释掉,将ask修改为no

vim /etc/ssh/ssh.config

报错三:ssh 公网ip地址

Warning: Permanently added '8.219.56.85' (ECDSA) to the list of kNown hosts.

解决办法:在本地机/root/.ssh下创建config文件,并在config文件中写入UserKNownHostsFile ~/.ssh/kNown_hosts

touch config
vim config

报错四:ssh 公网ip地址

root@8.219.56.85: Permission denied (publickey).

解决办法:在本地机下的.ssh下创建公钥与私钥,需要输入的,全部回车就好

ssh-keygen

我们可以看见,ssh下多了两个文件id_rsa与id_rsa.pub,id_rsa.pub为公钥,需要将其中内容复制到服务器秘钥下

tail id_rsa.pub

服务器上的操作,编辑秘钥

vim /root/.ssh/authorized_keys

原文地址:https://www.jb51.cc/wenti/3285955.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐