OpenSSH Server (sshd_config) Hardening Configuration Generator
Create production-hardened Linux sshd_config files disabling root login, enforcing public keys, limiting ciphers, and setting idle timeouts.
Changing to a non-standard port stops 99% of automated port 22 credential bots.
# ==============================================================================
# OpenSSH Server Hardened Configuration (sshd_config)
# Target File: /etc/ssh/sshd_config
# Standards: CIS Linux Benchmark / Mozilla Infosec / NIST SP 800-53
# Generated by ToolsAA: https://toolsaa.com/tools/sshd-config-generator
# ==============================================================================
# ------------------------------------------------------------------------------
# 1. Network & Address Binding
# ------------------------------------------------------------------------------
Port 2222
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
# ------------------------------------------------------------------------------
# 2. Host Key Infrastructure (Ed25519 & RSA)
# ------------------------------------------------------------------------------
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
# ------------------------------------------------------------------------------
# 3. Logging & Auditing (VERBOSE records key fingerprints for auth tracing)
# ------------------------------------------------------------------------------
LogLevel VERBOSE
SyslogFacility AUTH
# ------------------------------------------------------------------------------
# 4. Authentication & Access Control
# ------------------------------------------------------------------------------
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
KbdInteractiveAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication no
KerberosAuthentication no
StrictModes yes
MaxAuthTries 3
MaxSessions 3
LoginGraceTime 30
AllowGroups ssh-users wheel
# ------------------------------------------------------------------------------
# 5. Cryptography Hardening (Ciphers, KEX, MACs & HostKeyAlgorithms)
# ------------------------------------------------------------------------------
KexAlgorithms [email protected],curve25519-sha256,[email protected],diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
Ciphers [email protected],[email protected],[email protected]
MACs [email protected],[email protected],[email protected]
HostKeyAlgorithms ssh-ed25519,[email protected],rsa-sha2-512,rsa-sha2-256
# ------------------------------------------------------------------------------
# 6. Session Lifecycle & Security Defenses
# ------------------------------------------------------------------------------
ClientAliveInterval 300
ClientAliveCountMax 2
TCPKeepAlive no
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
GatewayPorts no
PermitUserEnvironment no
Compression no
MaxStartups 10:30:60
UsePAM yes
# ------------------------------------------------------------------------------
# 7. Banners & Information Disclosure
# ------------------------------------------------------------------------------
PrintMotd no
PrintLastLog yes
Banner none
DebianBanner no
# ------------------------------------------------------------------------------
# 8. SFTP Subsystem
# ------------------------------------------------------------------------------
Subsystem sftp internal-sftpModern Cryptographic Standards
Restricts OpenSSH to post-quantum and curve25519 key exchange, ChaCha20-Poly1305 and AES-GCM AEAD ciphers, completely eliminating legacy CBC and 3DES vulnerabilities.
Zero-Trust Attack Surface Reduction
Enforces strict public key authentication, completely disables root password logins, prevents RegreSSHion (CVE-2024-6387) timing attacks, and terminates idle sessions.
Modular Drop-In & Zero-Downtime Test
Generates full configs or modern drop-in conf.d files alongside a verified deployment shell script featuring sshd -t syntax verification before daemon reloading.