Zuhause / Guides / SSH-Härtung

SSH-Härtung Mindestens 8 Minuten

Jede öffentliche VPS wird innerhalb von Minuten nach dem Online-Handeln brutal erzwungen. Dies ist die Basislinie, die es stoppt. Funktioniert auf jedem Ubuntu/Debian-Server – auch auf unserem.

1. Schlüssel zuerst (sperren Sie sich niemals aus)

# on YOUR computer:
ssh-keygen -t ed25519 -C "vps"
ssh-copy-id root@YOUR_SERVER_IP
ssh root@YOUR_SERVER_IP        # must log in WITHOUT password — verify!

2. Passwortanmeldungen töten

sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
systemctl reload ssh
# keep this session open; test a NEW connection before closing it

3. Firewall + Brute-Force-Schutz

apt install -y ufw fail2ban
ufw default deny incoming && ufw default allow outgoing
ufw allow OpenSSH && ufw enable
cat > /etc/fail2ban/jail.local <<'EOF'
[sshd]
enabled = true
maxretry = 5
bantime = 1h
EOF
systemctl enable --now fail2ban

4. Automatische Sicherheitsupdates

apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades   # choose Yes

Das ist die 80/20 der Serversicherheit: Schlüssel, Firewall, Bans, Patches. Möchten Sie Schritt 1–2 überspringen? Unsere Server sind standardmäßig gehärtet - siehe Pläne.

Related