我正在尝试使用 lib ch.ethz.ssh2.Connection 通过 ssh2 连接到远程服务器
connexion = new Connection(host);
connexion.connect();
boolean isOK = connexion.authenticateWithPassword(login, pass);
但我在 connexion.connect(); 中得到一个 IOException 带有此错误消息:
Connection closed (Signature sent by remote is wrong!)
我尝试使用 Putty 连接到同一台服务器,我收到一条消息,告诉我指纹不是预期的,但如果我单击“是”以确认我可以连接。
我在 Java Doc 中读到我可以忽略密钥的验证,但不建议这样做(http://www.ganymed.ethz.ch/ssh2/javadoc/ch/ethz/ssh2/Connection.html#connect%28ch。 ethz.ssh2.ServerHostKeyVerifier,%20int,%20int%29)。
我正在寻找的是一种更改服务器中某些内容的方法,以便我可以正确连接。我不想更改 Java 代码。
谢谢,
奥特曼·马利赫