Make pwswitch off cover sudo -v, so Panama's installer runs without a password

This commit is contained in:
Gabriel Brown committed 2026-10-30 13:57:39 -04:00
1 parent cb089b39ea
commit 7cc98cd318
1 file changed
+4 -1
+4 -1
View File
@@ -13,7 +13,10 @@ case "${1:-}" in
off)
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
echo "${user} ALL=(ALL) NOPASSWD: ALL" >"$tmp"
# verifypw=any lets `sudo -v` pass on NOPASSWD alone. Without it, the
# wheel group's password rule still makes -v (and Panama's installer,
# which starts with it) ask for a password.
printf '%s\n' "Defaults:${user} verifypw=any" "${user} ALL=(ALL) NOPASSWD: ALL" >"$tmp"
# Validate before installing so a bad file can never lock sudo.
sudo visudo -cqf "$tmp"
sudo install -m 0440 -o root -g root "$tmp" "$dropin"