前几天尝试了SSH2的Client端调试,反复提示如下错误信息:
java.io.IOException: Password authentication failed.
...
Caused by: java.io.IOException: Authentication method password not supported by the server at this stage.
几经尝试,了解到原因:SSH登陆认证一般有两种方式:
一种是直接的password模式,直接采用用户名密码登陆,信道也是加密的,不过容易被虚假主机欺骗
一种是交互的指纹认证模式,通过一次交互在本地记录远程SSH主机的指纹,不会被虚假主机欺骗
我采用了password模式,而SSH主机没有开启该模式所以无法连通。
联通前可以通过isAuthMethodAvailable(String userName, String mode)查看SSH主机对应模式是否开启。
password模式开启方式:修改/etc/ssh/sshd_config 文件中PasswordAuthentication no 改为PasswordAuthentication yes,然后重启ssh服务/etc/init.d/sshd restart 即可
java.io.IOException: Password authentication failed.
...
Caused by: java.io.IOException: Authentication method password not supported by the server at this stage.
几经尝试,了解到原因:SSH登陆认证一般有两种方式:
一种是直接的password模式,直接采用用户名密码登陆,信道也是加密的,不过容易被虚假主机欺骗
一种是交互的指纹认证模式,通过一次交互在本地记录远程SSH主机的指纹,不会被虚假主机欺骗
我采用了password模式,而SSH主机没有开启该模式所以无法连通。
联通前可以通过isAuthMethodAvailable(String userName, String mode)查看SSH主机对应模式是否开启。
password模式开启方式:修改/etc/ssh/sshd_config 文件中PasswordAuthentication no 改为PasswordAuthentication yes,然后重启ssh服务/etc/init.d/sshd restart 即可