3

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
    }
}
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
DKWoo
  • 327
  • 5
  • 17

1 Answers1

7

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992