Update after.sh
This commit is contained in:
parent
bbbf918bd0
commit
fb2da4ee73
1 changed files with 12 additions and 11 deletions
23
after.sh
23
after.sh
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue