diff --git a/bin/omarchy-sudo-passwordless-toggle b/bin/omarchy-sudo-passwordless-toggle index 7dac33b2..9665ee41 100755 --- a/bin/omarchy-sudo-passwordless-toggle +++ b/bin/omarchy-sudo-passwordless-toggle @@ -6,7 +6,8 @@ NOPASSWD_FILE="/etc/sudoers.d/99-omarchy-nopasswd-${USER}" -if [ -f "$NOPASSWD_FILE" ]; then +# sudo -n succeeds without a password prompt when passwordless sudo is active +if sudo -n true 2>/dev/null; then sudo rm "$NOPASSWD_FILE" echo "Passwordless sudo has been DISABLED. Sudo will require a password again." else