dev-scripts/server-install-base.sh

32 lines
696 B
Bash
Executable File

#!/bin/sh
. ./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
apt upgrade -y || exit 10
apt install -y tmux ufw curl || exit 15
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
ufw allow ssh || exit 20
yes | ufw enable
EOSSH