Blueprints · Server Hardening
Beginner
10 min · Linux
SSH session limits
Stages idle and authentication limits. It does not change password login or root login.
Baked-in protections
- MaxAuthTries is 4
- Login grace is 30 seconds
- PasswordAuthentication is not edited
Step 1 · conf
sshd drop-in
/root/portgate-blueprints/50-session-limits.conf
Install this under sshd_config.d only after sshd -t succeeds. Keep the current session open.
ClientAliveInterval 300 ClientAliveCountMax 2 MaxAuthTries 4 LoginGraceTime 30
Step 2 · bash
Read-only check
/root/portgate-blueprints/ssh-limits-check.sh
Prints the live sshd settings. It does not reload sshd.
#!/bin/sh set -eu sshd -T 2>/dev/null | grep -Ei 'clientaliveinterval|maxauthtries|logingracetime|passwordauthentication|permitrootlogin' || echo "sshd -T did not run."