"USERAUTH fail" using gradle -ssh-plugin with id

I cannot connect to the SSH host using the Gradle SSH Plugin with my private key.

Specifying a password in build.gradleworks fine:

remotes {
    webServer {
        host = '<IP>'
        user = '<USER>'
        password = '<PASSWORD>'
    }
}

But in order not to write my password in the build file, I found that my environment connects using my private key without entering the password from the shell:

ssh <user>@<ip>

This command works from the shell, but I cannot achieve this with the Gradle plugin. This is my configuration:

remotes {
    webServer {
        host = '<IP>'
        user = '<USER>'
        identity = file("${System.getProperty('user.home')}/.ssh/id_rsa")
    }
}

Mistake:

Called: com.jcraft.jsch.JSchException: USERAUTH does not work in com.jcraft.jsch.UserAuthPublicKey.start (UserAuthPublicKey.java:119)

So how can I connect from the shell, what happened to my configuration?

+4
1

, agent = true:

remotes {
    webServer {
        host = '54.233.77.171'
        user = 'denis'
        agent = true
        identity = file("${System.getProperty('user.home')}/.ssh/id_rsa")
    }
}

agent. , Putty ssh-agent

:

UserAuthPublicKey:

if(userinfo==null) throw new JSchException("USERAUTH fail");
+9

Source: https://habr.com/ru/post/1612010/


All Articles