Update after.sh

This commit is contained in:
Baltrust 2026-10-14 15:53:49 +03:00
parent bbbf918bd0
commit fb2da4ee73

View file

@ -15,24 +15,25 @@ USER_HOME="/home/$USERNAME"
# NO PASSWORD SETUP # NO PASSWORD SETUP
# ───────────────────────────────────── # ─────────────────────────────────────
# ───────────────────────────────────── # ─────────────────────────────────────
# Configure temporary passwordless sudo # Temporarily enable passwordless sudo
# ───────────────────────────────────── # ─────────────────────────────────────
SUDOERS_FILE="/etc/sudoers.d/99-install-script" SUDOERS_FILE="/etc/sudoers.d/00_tadas"
SUDOERS_BACKUP="/etc/sudoers.d/00_tadas.backup"
cp "$SUDOERS_FILE" "$SUDOERS_BACKUP"
printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USERNAME" > "$SUDOERS_FILE" printf '%s ALL=(ALL:ALL) NOPASSWD: ALL\n' "$USERNAME" > "$SUDOERS_FILE"
chmod 440 "$SUDOERS_FILE" chmod 440 "$SUDOERS_FILE"
if ! visudo -c; then visudo -c || exit 1
rm -f "$SUDOERS_FILE"
exit 1
fi
echo "Temporary sudoers rule:" cleanup() {
cat "$SUDOERS_FILE" mv "$SUDOERS_BACKUP" "$SUDOERS_FILE"
rm -f /etc/sudoers.d/99-install-script
echo "Effective sudo permissions:" visudo -c
sudo -l -U "$USERNAME" }
trap cleanup EXIT
# ───────────────────────────────────── # ─────────────────────────────────────
# Misc # Misc