Skip to content

Instantly share code, notes, and snippets.

@nicwolff
Created February 9, 2016 22:29
Show Gist options
  • Save nicwolff/7c113328412765eaf83e to your computer and use it in GitHub Desktop.
Save nicwolff/7c113328412765eaf83e to your computer and use it in GitHub Desktop.
Pass password and command to PSSH sudo
( echo "PASSWORD" ; echo "COMMAND" ) | pssh -t 1 -h ~/host_list -P -I "sudo -S su -"
@guce
Copy link

guce commented May 10, 2018

echo "$PSWD" | pssh -h $HOST -l $USER -I "sudo -S -- sh -c '$COMMAND'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment