Staging #2

Merged
admin merged 5 commits from Staging into main 2025-10-28 01:07:19 +00:00
Showing only changes of commit 9fb8c8b153 - Show all commits

View File

@@ -41,7 +41,7 @@ systemctl restart ssh || service ssh restart
# === INSTALL BASIC UTILITIES === # === INSTALL BASIC UTILITIES ===
echo "Installing base packages..." echo "Installing base packages..."
apt install -y curl wget vim git ufw apt install -y curl wget vim git ufw wamerican
# === FIREWALL CONFIGURATION === # === FIREWALL CONFIGURATION ===
echo "Configuring firewall..." echo "Configuring firewall..."
@@ -57,4 +57,30 @@ systemctl restart ssh || service ssh restart
# === ENSURE beer CAN USE SUDO === # === ENSURE beer CAN USE SUDO ===
usermod -aG sudo beer usermod -aG sudo beer
# Make sure /usr/share/dict/words exists, or replace with your own file path or word array
WORDLIST="/usr/share/dict/words"
# Pick 5 random words, capitalize first letter
PASSWORD_WORDS=$(shuf -n 5 "$WORDLIST" | sed 's/.*/\L&/' | sed 's/^./\u&/' | tr '\n' ' ')
# Generate 4 random digits
PASSWORD_NUMBERS=$(shuf -i 1000-9999 -n 1)
# Combine words and numbers
GENERATED_PASS="${PASSWORD_WORDS}${PASSWORD_NUMBERS}"
# Remove trailing spaces if any
GENERATED_PASS=$(echo "$GENERATED_PASS" | xargs)
# Set password for user beer
echo "beer:$GENERATED_PASS" | chpasswd
# Show the generated password
echo "--------------------------------------------------"
echo "Generated password for user 'beer':"
echo "$GENERATED_PASS"
echo "Please save this password securely!"
echo "--------------------------------------------------"
echo "Setup complete! You can now SSH into the container/VM as '$USERNAME'." echo "Setup complete! You can now SSH into the container/VM as '$USERNAME'."