简体   繁体   中英

JSchException: Auth fail on ubuntu 22.04

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
    }
}

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM