远程连接服务器,报异常: com.jcraft.jsch.JSchException: Auth fail 或者java.net.SocketTimeoutException: Read timed out [preauth]
解决办法:
-
登录被连接服务器
-
在/etc/ssh/sshd_config 文件中,PermitRootLogin yes 把这行的注释取消掉,也就是允许root远程登录(如不需要连接root,可不修改此条内容)
-
在 /etc/ssh/sshd_config 中 GSSAPIAuthentication 修改为 no
-
为了加快SSH的登录速度,把 /etc/ssh/sshd_config 文件中 UseDNS yes 修改为 no
-
重启sshd服务。systemctl restart sshd.service