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
# ─────────────────────────────────────
# ─────────────────────────────────────
# 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"
chmod 440 "$SUDOERS_FILE"
if ! visudo -c; then
rm -f "$SUDOERS_FILE"
exit 1
fi
visudo -c || exit 1
echo "Temporary sudoers rule:"
cat "$SUDOERS_FILE"
echo "Effective sudo permissions:"
sudo -l -U "$USERNAME"
cleanup() {
mv "$SUDOERS_BACKUP" "$SUDOERS_FILE"
rm -f /etc/sudoers.d/99-install-script
visudo -c
}
trap cleanup EXIT
# ─────────────────────────────────────
# Misc