SSH brute-force is the #1 attack on Linux servers. Basic hardening in 30 min blocks 99% of attacks: disable password auth (keys only), change the port from 22, AllowUsers whitelist, fail2ban for brute-force, optional TOTP MFA. Always keep a second terminal open when editing sshd_config in case of errors.
Below: step-by-step, working examples, common pitfalls, FAQ.
ssh-keygen -t ed25519 -a 100ssh-copy-id user@hostPasswordAuthentication no, PubkeyAuthentication yes, PermitRootLogin prohibit-passwordAllowUsers admin deploy (user whitelist)Port 2222) — security through obscurity; 90% of attacks target port 22sshd -t to check config, systemctl reload sshdapt install fail2ban (default sshd jail already set)| Scenario | Config |
|---|---|
| Basic /etc/ssh/sshd_config | Port 2222
PermitRootLogin prohibit-password
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers admin
ClientAliveInterval 300
ClientAliveCountMax 2
MaxAuthTries 3 |
| Generate ed25519 key | ssh-keygen -t ed25519 -a 100 -C "admin@example.com" |
| Fail2ban sshd jail | [sshd]
enabled = true
maxretry = 3
bantime = 3600
findtime = 600 |
| TOTP MFA (pam_google_authenticator) | apt install libpam-google-authenticator\ngoogle-authenticator # run as user\n# Then edit /etc/pam.d/sshd + sshd_config: ChallengeResponseAuthentication yes |
| UFW + SSH rate-limit | ufw limit 2222/tcp # 6 connections per 30 sec |
The tool checks HTTP security headers, SSL/TLS configuration, server info leaks, and protection against common attacks (XSS, clickjacking, MIME sniffing). A grade fromA to F shows overall security level.
Checking Content-Security-Policy, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and more.
TLS version, certificate expiry, chain of trust, HSTS support.
Finding exposed server versions, debug modes, open configs, and directories.
Detailed report explaining each issue with specific steps to fix it.
HTTP header audit
config verification
CSP & HSTS setup
compliance checks
Strict-Transport-Security.Server: Apache/2.4.52 helps attackers find exploits. Hide the version.DENY or SAMEORIGIN.nosniff, browsers may misinterpret file types (MIME sniffing).Content-Security-Policy-Report-Only, monitor violations, then enforce.Server, X-Powered-By, X-AspNet-Version from responses.Security check history and HTTP security header monitoring.
Sign up freeed25519 is faster, more modern, shorter (32 bytes vs 2048+ bit). RSA only for legacy clients (pre-2014).
Security through obscurity. Blocks mass bot scanners (90% scan only :22). Does not stop targeted attack on your server.
Better <code>PermitRootLogin prohibit-password</code> (key-only) + sudo user. Full no — requires console access for emergencies.
<a href="/en/security">Enterno Security Scanner</a> + <code>ssh-audit</code> open-source tool. Plus audit auth.log for failed attempts.