bootstrap.sh aktualisiert

edit ssh_config file
This commit is contained in:
kevinheyer 2025-06-12 19:43:32 +00:00
parent 029706d7c6
commit 18d3fbb3c6

View file

@ -22,7 +22,7 @@ SSH_DIR="/home/$USERNAME/.ssh"
# Update package list and install necessary packages
echo "[+] Updating package list and installing essential packages..."
apt-get update
apt-get install -y wget
apt-get install -y wget openssh-server
# Setting up SSH directory and authorized keys
echo "[+] Setting up SSH directory..."
@ -32,6 +32,17 @@ chown -R "$USERNAME:$USERNAME" "$SSH_DIR"
chmod 700 "$SSH_DIR"
chmod 600 "$SSH_DIR/authorized_keys"
# Configure SSH server to allow public key authentication
echo "[+] Configuring SSH server..."
SSH_CONFIG="/etc/ssh/sshd_config"
sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/' "$SSH_CONFIG"
sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' "$SSH_CONFIG"
sed -i 's/^#AuthorizedKeysFile/AuthorizedKeysFile/' "$SSH_CONFIG"
sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' "$SSH_CONFIG"
# Restart SSH service to apply changes
systemctl restart ssh
# Adding user to sudo group
echo "[+] Adding user to sudo group..."
apt-get install -y sudo