【linux】SCP或SSH 连接失败: no matching host key type found. Their offer: ssh-rs

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 会话并返回到本地命令行终端。
  • 11
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值