Enable call sudo without password

This commit is contained in:
Martin Blazik
2023-02-25 19:17:27 +01:00
parent dbe870ab5f
commit fbe35a8fa9

11
scripts/sudo-user.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -E -o errexit -o nounset -o pipefail
USER_FILE="/etc/sudoers.d/$USER"
if [ -f $USER_FILE ]; then
echo "Sudo file $USER_FILE already exists!"
exit 1
fi
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee $USER_FILE