scp或者ssh报错“no matching host key type found. Their offer: ssh-rsa,ssh-dss“
原因:OpenSSH 7.0以后的版本不再支持ssh-dss (DSA)算法

aab@aab-virtual-machine:~/桌面/lianxi$ scp text.c root@192.168.1.50:/home/root
Unable to negotiate with 192.168.1.50 port 22: no matching host key type found. Their offer: ssh-rsa
lost connection

或者

root:~ >ssh root@192.168.1.133
Unable to negotiate with 192.168.1.133 port 22: no matching host key type found. Their offer: ssh-rsa

解决办法: 

ssh -i key.pem shell@x.x.x.x -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa

 1每次指令后加上-oHostKeyAlgorithms=+ssh-dss或者-oHostKeyAlgorithms=+ssh-dsa:

2.(推荐)也可以把参数加到 ssh config file, /etc/ssh/ssh_config :,增加以下内容:

HostKeyAlgorithms = +ssh-rsa
PubkeyAcceptedAlgorithms = +ssh-rsa

退出 SSH 连接的方法有以下几种

  • 使用 exit 命令。
  • 使用 logout 命令。
  • 使用 Ctrl + D 键盘组合。
  • 如果 SSH 连接被冻结,可以键入 ~. 关闭 SSH 会话并返回到本地命令行终端。
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐