Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executeSudo doesn't prompt for sudo password #312

Open
jcarrete5 opened this issue Feb 22, 2018 · 1 comment
Open

executeSudo doesn't prompt for sudo password #312

jcarrete5 opened this issue Feb 22, 2018 · 1 comment

Comments

@jcarrete5
Copy link

Environment info

gradle-ssh-plugin-2.9.0 (groovy-ssh-2.9.0, jsch-0.1.53, groovy-2.4.12, java-1.8.0_144)

Description

When I try to execute the deploy task, the executeSudo method doesn't prompt for sudo password. I have tried using other solutions for getting the sudo password from the user described in #302 and #16. When I run the task I get the error org.hidetake.groovy.ssh.interaction.InteractionException: Error while stream interaction: org.hidetake.groovy.ssh.session.execution.SudoException: Failed sudo authentication on jsonet[jsonet.ddns.net:22]: Sorry, try again.

The task works fine when I set the sudoPassword in plain text but I would really like to avoid storing the sudo password in plain text somewhere.

task deploy(dependsOn: distTar) {
    description = 'Uploads the server distribution to the remote app server.'
    group = 'distribution'
    doLast {
        ssh.run {
            session(remotes.role('appServer')) {
                def targetFile = "${applicationName}-${version}.tar"
                put from: new File(new File(buildDir, "distributions"), targetFile),
                    into: "/tmp"
                executeSudo "mv /tmp/$targetFile /opt", pty: true
            }
        }
    }
}
@Helios-23
Copy link

Error is Still occurring as specified above. Any Updates or work arounds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants