Solve 'com.jcraft.jsch.JSchException: Auth fail.' exception with REHL 9 instance in AWS .
This page tells you how to solve the "com.jcraft.jsch.JSchException:
Auth fail." exception when you are trying to connect redhat linux (RHEL)
9 from a java clinet program over SSH using jsch library/jar and
authenticated by key or password.
If you trying to connect Red Hat Linux (RHEL) centos 9 over SSH using
jsch library and getting following exception, you can solve it by
following change..
"com.jcraft.jsch.JSchException: Auth fail."
Exception:
Exception in thread "main" com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect(Session.java:519)
at com.jcraft.jsch.Session.connect(Session.java:183)
at comz.ConnectSSH1.main(ConnectSSH1.java:41)
Solution:
Update crypto-policies of the linux server. set DEFAULT:SHA1 crypto
policy executing the
command
: "update-crypto-policies --set DEFAULT:SHA1" .
Reboot the system also as the plicy update is gloabl and it will impact
all the application connecting to this box.
Note:
It will lower the sccurity of your linux server.
Screenshot: