Created
October 11, 2021 04:50
-
-
Save jcefoli/eca0c6a7b46361e8d2671cb08b04cb70 to your computer and use it in GitHub Desktop.
Remove password prompt from sudo elevation, with paranoia checks (Ubuntu 20.04 LTS)
This file contains hidden or 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 | |
cp --no-preserve=mode,ownership /etc/sudoers /etc/sudoers.tmp | |
sed -i "s/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL) NOPASSWD: ALL/g" /etc/sudoers.tmp | |
visudo -c -f /etc/sudoers.tmp | |
if [ "$?" -eq "0" ]; then | |
cp /tmp/sudoers.tmp /etc/sudoers | |
else | |
echo "Something went wrong" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment