目录

SSH命令问题汇总

no matching host key type found. Their offer: ssh-dss

使用SSH登录时报错如下:

1
Unable to negotiate with 20.1.1.174 port 22: no matching host key type found. Their offer: ssh-dss

报错原因是OpenSSH7.0之后不再支持ssh-dss算法,可以通过添加参数-oHostKeyAlgorithms=+ssh-dss来支持该算法:

1
sftp -oHostKeyAlgorithms=+ssh-dss -i id_rsa test@20.1.1.174

Permissions 0644 for ‘id_rsa’ are too open

使用SSH登录时报错如下:

1
2
3
Permissions 0644 for 'id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

这个报错是因为id_rsa是私钥文件,属于敏感文件,不能开放权限给其他用户组,哪怕是只读也不行,在缩小权限之前该私钥文件将一直被忽略。

通过赋予该文件400或600的权限即可成功登陆SSH:

1
2
chmod 400 id_rsa
chmod 600 id_rsa

参考链接

警告
本文最后更新于 June 20, 2023,文中内容可能已过时,请谨慎使用。