diff --git a/usr/bin/passwordless-root b/usr/bin/passwordless-root index 29659a8..8a69cae 100755 --- a/usr/bin/passwordless-root +++ b/usr/bin/passwordless-root @@ -21,6 +21,11 @@ command -v sponge >/dev/null ## sudo configuration syntax check and atomic writes. command -v visudo >/dev/null +if [ ! "$(id -u)" = "0" ]; then + true "$0: ERROR: This program must be run as root!" + exit 1 +fi + passwordless_sudo_non_qubes() { echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null true "\ @@ -40,11 +45,6 @@ passwordless_sudo_qubes() { exit 1 fi - if [ ! "$(id -u)" = "0" ]; then - true "$0: ERROR: This program must be run as root!" - exit 1 - fi - true "$0 INFO: Creating file...: /etc/sudoers.d/nopassword" ## Temporary passwordless sudo until reboot.