From b465b0519aec79875938994b6dd274d3620ef0cf Mon Sep 17 00:00:00 2001 From: Baltrust Date: Wed, 14 Oct 2026 16:32:10 +0300 Subject: [PATCH] Update after.sh --- after.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/after.sh b/after.sh index fccbd95..14d0c46 100644 --- a/after.sh +++ b/after.sh @@ -18,7 +18,10 @@ USER_HOME="/home/$USERNAME" # Temporarily enable passwordless sudo # ───────────────────────────────────── -SUDOERS_FILE="/etc/sudoers.d/99-install-script" +SUDOERS_FILE="/etc/sudoers.d/00_$USERNAME" +SUDOERS_BACKUP="${SUDOERS_FILE}.backup" + +cp "$SUDOERS_FILE" "$SUDOERS_BACKUP" printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USERNAME" > "$SUDOERS_FILE" chmod 440 "$SUDOERS_FILE" @@ -26,7 +29,8 @@ chmod 440 "$SUDOERS_FILE" visudo -c || exit 1 cleanup() { - rm -f "$SUDOERS_FILE" + mv "$SUDOERS_BACKUP" "$SUDOERS_FILE" + rm -f /etc/sudoers.d/99-install-script visudo -c } trap cleanup EXIT