Created
November 6, 2021 01:52
-
-
Save lookfirst/370f4752b1265e86e256ba431a60aa84 to your computer and use it in GitHub Desktop.
keywords: sshpass sudoers nopasswd ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export SSHPASS="1" | |
sshpass -e ssh -o "UserKnownHostsFile=/dev/null" -o StrictHostKeychecking=no -o LogLevel=ERROR user@$1 \ | |
"echo $SSHPASS | sudo -S bash -c 'echo \"user ALL=(ALL) NOPASSWD:ALL\" > /etc/sudoers.d/00-user_nopasswd' 2> /dev/null" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-user_nopasswd