命令行传密码
1 | sshpass -p ${PWD} ssh -o stricthostkeychecking=no root@192.168.1.1 |
报错处理
Unable to negotiate with 192.168.1.254 port 22: no matching host key type found. Their offer: ssh-rsa
原因为:没有找到相关的主机密钥类型(ssh-rsa)。
解决: ssh -o HostKeyAlgorithms=+ssh-rsa user@host
或者
1 | $ cat .ssh/config |
同理:
...Their offer: diffie-hellman-group1-sha1
解决: -o KexAlgorithms=+diffie-hellman-group1-sha1
...Their offer: ssh-dss
解决:-o HostKeyAlgorithms=+ssh-dss
...Their offer: 3des-cbc
解决:-o Ciphers=+3des-cbc
1 | ssh -o KexAlgorithms=+diffie-hellman-group1-sha1 -o HostKeyAlgorithms=+ssh-dss -o Ciphers=+3des-cbc user@host |