add install base script

This commit is contained in:
Ray Elliott 2020-09-03 18:07:38 +01:00
parent de93d3b6ec
commit 34a29a0a4e
1 changed files with 15 additions and 0 deletions

15
install/scripts/install-base.sh Executable file
View File

@ -0,0 +1,15 @@
#!/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