Home > Software design >  JSchException: Auth fail on ubuntu 22.04
JSchException: Auth fail on ubuntu 22.04

Time:07-28

I recently changed my cloud server OS from ubuntu 20.04 to 22.04. After that, remote upload jar task fail during gradle build using org.hidetake.ssh with below message.

com.jcraft.jsch.JSchException: Auth fail

I guess it could be a rsa problem which is deprecated on ubuntu 22.04 but I can't find how to resolve it.

The config I'm used with ssh.run task is below. I would really appreciate if anyone has idea.

remotes {
    myServer {
        host = 'x.x.x.x'
        port = 22
        user = 'ubuntu'
        identity = file('d:/a.pem') 
        knownHosts = allowAnyHosts
    }
}

CodePudding user response:

It's indeed quite likely that the server requires rsa-sha2. JSch does not support it. And as JSch seems not to be updated anymore, it quite likely never will.

There's a fork of JSch that does though:
https://github.com/mwiede/jsch


Another (less secure obviously) option is to reconfigure the server not to require the rsa-sha2 by adding deprecated ssh-rsa to PubkeyAcceptedAlgorithms.

  • Related