【报错】Their offer: ssh-rsa,ssh-dss

登录机器时报错:Unable to negotiate with x.x.x.x port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

根本原因是:OpenSSH7.0以后的版本不再支持ssh-dss(DSA)算法,官方的说法是这个算法太弱了。MACOS升到10.12附带的openssh
版本是7.4,如下:➜~sshd-Vsshd:illegaloption–VOpenSSH_7

方案一 命令行添加选项 ssh -oHostKeyAlgorithms=+ssh-dss user@host -p port

ssh -oHostKeyAlgorithms=+ssh-rsa 用户名@ip地址

示例:
sftp -P 20001 -oHostKeyAlgorithms=+ssh-dss test@192.168.10.128
ssh -oHostKeyAlgorithms=+ssh-dss root@www.xxx.cn

方案二:在ssh的配置文件中添加全局选项

HostKeyAlgorithms +ssh-dss

  • 添加到配置 ~/.ssh/config
  • 添加到 /etc/ssh/ssh_config
方案三:在 ~/.ssh/config 中添加下面几行

HostKeyAlgorithms ssh-rsa
PubkeyAcceptedKeyTypes ssh-rsa

参考链接:
https://www.twle.cn/t/90568
https://blog.csdn.net/u013214821/article/details/122804133
mac下使用配置文件config, SSH连接服务器:https://blog.csdn.net/Enceladuce/article/details/102372590

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值