Skip to content

Commit

Permalink
fix passwordless-root: make sure that VISUAL and SUDO_EDITOR environm…
Browse files Browse the repository at this point in the history
…ent variables do not interfere with EDITOR=tee
  • Loading branch information
adrelanos committed Nov 21, 2024
1 parent eb087e0 commit 20db567
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions usr/bin/passwordless-root
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if ! test -w "/etc/sudoers.d/" ; then
fi

passwordless_sudo_non_qubes() {
echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null
echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | SUDO_EDITOR="" VISUAL="" EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null
true "\
$0: INFO: OPTIONAL:
sudo cat /etc/sudoers.d/nopassword
Expand All @@ -58,12 +58,12 @@ passwordless_sudo_qubes() {
true "$0 INFO: Creating file...: /etc/sudoers.d/nopassword"

## Temporary passwordless sudo until reboot.
echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null
echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | SUDO_EDITOR="" VISUAL="" EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null

true "$0: INFO: Appending to file...: /rw/config/rc.local"

## Permanent passwordless sudo after reboot.
append-once /rw/config/rc.local 'echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null' >/dev/null
append-once /rw/config/rc.local 'echo "user ALL=(ALL:ALL) NOPASSWD:ALL" | SUDO_EDITOR="" VISUAL="" EDITOR=tee visudo -f /etc/sudoers.d/nopassword >/dev/null' >/dev/null

if ! test -x /rw/config/rc.local ; then
chmod +x /rw/config/rc.local
Expand Down

0 comments on commit 20db567

Please sign in to comment.