bootstrap.sh aktualisiert
edit ssh_config file
This commit is contained in:
parent
029706d7c6
commit
18d3fbb3c6
1 changed files with 12 additions and 1 deletions
13
bootstrap.sh
13
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
|
||||
|
|
Loading…
Add table
Reference in a new issue