1. System Update & User Setup
Begin every deployment by updating existing packages and creating a non-root sudo operator:
sudo apt update && sudo apt upgrade -y
sudo adduser deployer
sudo usermod -aG sudo deployer2. SSH Hardening
Disable root login and password authentication inside /etc/ssh/sshd_config:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
X11Forwarding noReload the SSH service:
sudo systemctl restart sshd3. Configure UFW Firewall
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable