From 18d3fbb3c676f305a24599f46da7b3c1e41675f3 Mon Sep 17 00:00:00 2001 From: kevinheyer Date: Thu, 12 Jun 2025 19:43:32 +0000 Subject: [PATCH] bootstrap.sh aktualisiert edit ssh_config file --- bootstrap.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 2f530f7..6cc3e32 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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