Security bash Beginner

SSH Hardening Config

Minimal sshd_config changes to harden SSH: disable root login, password auth, and old ciphers.

bash
# Add to /etc/ssh/sshd_config
Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
X11Forwarding no
MaxAuthTries 3
ClientAliveInterval 300

# Reload: systemctl reload sshd

Prerequisites

  • OpenSSH server

Pro Tips

  • → Test config with sshd -t before reloading.
  • → Keep a backup session open while changing port.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Beginner
Read time
3 min
Published
Feb 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.