no matching host key type found. Their offer: ssh-dss {#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 {#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