ssh 更改默认身份验证

时间:2021-02-05 11:28:39

标签: ubuntu ssh router cisco

当我尝试访问启用了 ssh 的路由器时,它说:

Unable to negotiate with 101.16.16.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

为了解决这个问题,我可以执行以下命令强制ssh使用路由器使用的认证方式

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c aes128-cbc -l <username> 10.10.10.5

有什么办法可以将 ssh 配置为默认使用该身份验证。谢谢

1 个答案:

答案 0 :(得分:2)

您可以编辑 ~/.ssh/config 并添加主机 IP 和密码的信息。在您的情况下,它应该说明:

Host 101.16.16.2
    KexAlgorithms +diffie-hellman-group1-sha1
    Ciphers aes128-cbc