问题:
从OpenSSH 7.x开始,DSA密钥算法组件默认被禁用。相关文档是这样说的:
OpenSSH 7.0 and greater similarly disable the ssh-dss (DSA) public key algorithm. It too is weak and we recommend against its use.
“OpenSSH Legacy Options”:http://www.openssh.com/legacy.html
如果不加任何参数或配置,DSA密钥是无法SSH登录的,会提示如下结果:
sign_and_send_pubkey: no mutual signature supported
解决方法一:命令行参数法
在SSH命令行中添加参数“-o HostKeyAlgorithms=+ssh-dss -o PubkeyAcceptedKeyTypes=+ssh-dss”。例子:
ssh -o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-dss -o PubkeyAcceptedKeyTypes=+ssh-dss -i ~/.ssh/pri_dsa_key_file root@192.168.64.111
解决方法二:配置文件法(针对某个host)
修改~/.ssh/config,对应的host添加对应的参数“HostKeyAlgorithms +ssh-dss”和“PubkeyAcceptedKeyTypes=+ssh-dss”。
~/.ssh/config记得权限要修改成0600。
例子:
Host servername.com
HostName 192.168.64.111
IdentityFile ~/.ssh/pri_dsa_key_file
PubkeyAcceptedKeyTypes=+ssh-dss
HostKeyAlgorithms +ssh-dss
解决方法三:配置文件法(全体host)(不推荐)
该方法对全体host有效,可能存在安全隐患,不推荐使用。
修改~/.ssh/config,对Host *添加对应的参数“HostKeyAlgorithms +ssh-dss”和“PubkeyAcceptedKeyTypes=+ssh-dss”。
~/.ssh/config记得权限要修改成0600。
例子:
Host *
PubkeyAcceptedKeyTypes=+ssh-dss
HostKeyAlgorithms +ssh-dss
参考:
https://security.stackexchange.com/questions/112802/why-openssh-deprecated-dsa-keys