From 029706d7c626295e2b9cc5dbaf4d4c24ba27ba28 Mon Sep 17 00:00:00 2001 From: kevinheyer Date: Thu, 12 Jun 2025 19:29:44 +0000 Subject: [PATCH] bootstrap.sh aktualisiert Change to userinput --- bootstrap.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index f2c9738..2f530f7 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -7,8 +7,15 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi -# Use the current user -USERNAME=$(whoami) +# Prompt for username input +read -p "Bitte geben Sie den Benutzernamen ein: " USERNAME + +# Check if the username is not empty +if [ -z "$USERNAME" ]; then + echo "[✗] Kein Benutzername eingegeben." >&2 + exit 1 +fi + SSH_KEY_URL="https://skulldev.de/Skull-IT/trusted-ssh-keys/raw/branch/main/trusted-ssh-keys" SSH_DIR="/home/$USERNAME/.ssh" @@ -32,7 +39,7 @@ usermod -aG sudo "$USERNAME" # Configuring passwordless sudo for the user echo "[+] Configuring passwordless sudo for $USERNAME..." -echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/$USERNAME" +echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" | tee "/etc/sudoers.d/$USERNAME" > /dev/null chmod 440 "/etc/sudoers.d/$USERNAME" # Setting timezone