出现这种情况通常是因为你的SSH配置文件格式不正确,如果你像这样尝试连接:
ssh -v -i [your private key file] [username]@[remote_machine]
你可能会得到如下错误
Unable to negotiate with 192.168.1.1 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
解决方法是修改/etc/ssh/ssh_config文件(如果你想修改ssh客户端,可以将修改加到~/.ssh/config中),在文件末尾加上以下内容:
Host *
KexAlgorithms +diffie-hellman-group1-sha1
然后,你就可以连接到远程机器上了。