Open maltalex opened 7 years ago
I use:
task run_pi_home {
doLast {
ssh.run {
session(remotes.pi_home) {
remotes.pi_home.password="$word"
}
}
}
}
./gradlew run_pi_home -Pword=
A nice solution I've found is presented bellow. It asks the password during the build and masks the characters:
def pass = "";
remotes {
webServer {
host = 'localhost'
port = 22
user = 'user'
}
}
task deploy {
doLast {
pass = new String(System.console().readPassword("\nPlease enter password: "))
remotes.webServer.password = pass
ssh.run {
session(remotes.webServer) {
....
}
}
}
}
Thanks for https://www.timroes.de/2014/01/19/using-password-prompts-with-gradle-build-files/
pass = new String(System.console().readPassword("\nPlease enter password: ")) remotes.webServer.password = pass
System.console() is null
Instead of defining a password/passphrase within the gradle script or an environment variable, is there a way of prompting for a password from the command line when initiating an ssh session with a specific machine? I'd like to avoid storing plain text files anywhere.
I tried reading from
System.in
in thessh.run
block, but that didn't work.