Basis Packete
sudo apt update && sudo apt dist-upgrade -y && sudo apt install vim ufw ncdu htop git -y
Führen Sie diesen Befehl auf dem Rechner aus, von dem aus Sie sich mit dem Server verbinden wollen
ssh-copy-id -i .ssh/id_rsa -p 22 USER@SERVERADRESS
ssh USER@SERVERADRESS
sudo vim /etc/ssh/sshd_config
# Ensure following line
PasswordAuthentication no
PubkeyAuthentication yes
sudo apt install fail2ban && echo "[sshd]" >> /etc/fail2ban/jail.conf && echo "enabled = true" >> /etc/fail2ban/jail.conf && sudo systemctl restart fail2ban
sudo apt install unattended-upgrades apt-listchanges -y && sudo dpkg-reconfigure -plow unattended-upgrades
sudo ufw allow ssh
sudo ufw allow # The ports/services which should be accesible from the outside
sudo ufw enable
sudo crontab -e
50 1 * * * reboot # daily at 1:50 am
sudo echo "SystemMaxUse=1G" >> /etc/systemd/journald.conf && sudo systemctl restart systemd-journald.service