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

16 lines
472 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
apt install -y ufw || (echo "ERROR while installing ufw" ; exit 15)
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
yes | ufw enable
EOSSH