dev-scripts/server-install-base.sh

32 lines
696 B
Bash
Raw Normal View History

2020-06-08 18:59:06 +00:00
#!/bin/sh
2020-06-12 22:41:13 +00:00
. ./config
if [ "$1" = 'local' ] ; then
src_url="$local_url";
dest_url="$remote_url";
src_ssh="$local_ssh"
elif [ "$1" = 'remote' ] ; then
src_url="$remote_url";
dest_url="$local_url";
src_ssh="$remote_ssh"
else
echo "error: must specify local or remote"
exit 5
fi
ssh -T $src_ssh << EOSSH
2020-06-08 21:32:05 +00:00
apt upgrade -y || exit 10
apt install -y tmux ufw curl || exit 15
2020-06-08 19:20:39 +00:00
2020-06-08 20:42:47 +00:00
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
2020-06-08 19:20:39 +00:00
ufw allow ssh || exit 20
2020-06-08 20:17:30 +00:00
yes | ufw enable
2020-06-08 20:42:47 +00:00
2020-06-12 22:41:13 +00:00
EOSSH