dev-scripts/scripts/debian10/install-base.sh

19 lines
574 B
Bash
Executable File

#!/bin/sh
ssh -T $ssh << EOSSH
sed -i '/PubkeyAuthentication/c\PubkeyAuthentication yes' /etc/ssh/sshd_config
sed -i '/PasswordAuthentication/c\PasswordAuthentication no' /etc/ssh/sshd_config
sed -i '/PermitRootLogin/c\PermitRootLogin prohibit-password' /etc/ssh/sshd_config
systemctl restart sshd
export DEBIAN_FRONTEND=noninteractive
echo "Installing packages .."
apt-get install -qq -y ufw || (echo "ERROR while installing ufw" ; exit 15)
echo "Packages installed"
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
yes | ufw enable
EOSSH