Fixed bug #62924: Allow sshpass password in $SSHPASS.

This commit is contained in:
Ole Tange 2022-08-30 23:43:46 +02:00
parent bbb94ab9e4
commit 0da05fe981
3 changed files with 4 additions and 0 deletions

View file

@ -6895,6 +6895,7 @@ sub new($$) {
# user[:pass] # user[:pass]
if($userpw =~ s/:(.*)//) { if($userpw =~ s/:(.*)//) {
$password = $1; $password = $1;
if($password eq "") { $password = $ENV{'SSHPASS'} }
if(not ::which("sshpass")) { if(not ::which("sshpass")) {
::error("--sshlogin with password requires sshpass installed"); ::error("--sshlogin with password requires sshpass installed");
::wait_and_exit(255); ::wait_and_exit(255);

View file

@ -30,6 +30,8 @@ par_sshpass_with_password() {
echo '### sshpass' echo '### sshpass'
echo OK | parallel -S "sshpass -p $withpassword ssh withpassword@lo:22" echo echo OK | parallel -S "sshpass -p $withpassword ssh withpassword@lo:22" echo
echo OK | parallel -S withpassword:"$withpassword"@lo:22 echo echo OK | parallel -S withpassword:"$withpassword"@lo:22 echo
export SSHPASS="$withpassword"
echo OK | parallel -S withpassword:@lo:22 echo
} }
par_ssh_ssh() { par_ssh_ssh() {

View file

@ -100,6 +100,7 @@ par_sshlogin_with_comma OK
par_sshpass_with_password ### sshpass par_sshpass_with_password ### sshpass
par_sshpass_with_password OK par_sshpass_with_password OK
par_sshpass_with_password OK par_sshpass_with_password OK
par_sshpass_with_password OK
par_stop_if_no_hosts_left ### Stop if all hosts are filtered and there are no hosts left to run on par_stop_if_no_hosts_left ### Stop if all hosts are filtered and there are no hosts left to run on
par_stop_if_no_hosts_left parallel: Warning: Removed no-such.host. par_stop_if_no_hosts_left parallel: Warning: Removed no-such.host.
par_stop_if_no_hosts_left parallel: Error: Cannot run any jobs. par_stop_if_no_hosts_left parallel: Error: Cannot run any jobs.