sshd -tValidate sshd_config syntax before restart.
sshd administration, config validation, systemd control, logging, hardening, authorized keys, and certificates.
Test, inspect, and manage the OpenSSH server.
sshd -tValidate sshd_config syntax before restart.
sshd -TDump effective server configuration values.
Evaluate Match blocks for a chosen user and source address.
sshd -T -C user=deploy,host=server.example.com,addr=203.0.113.10Evaluate Match blocks for a chosen user and source address.
Restart the SSH daemon on systemd-based Linux hosts.
sudo systemctl restart sshdRestart the SSH daemon on systemd-based Linux hosts.
sudo systemctl status sshdInspect the daemon status on systemd-based hosts.
sudo journalctl -u sshd -fFollow SSH daemon logs via journald.
Start a test daemon without detaching, useful for troubleshooting.
sudo /usr/sbin/sshd -D -d -p 2222Start a test daemon without detaching, useful for troubleshooting.
Common server hardening and auth settings.
Require key-based authentication on the server.
PasswordAuthentication noRequire key-based authentication on the server.
PermitRootLogin noPrevent direct root SSH sessions.
Restrict which user accounts may log in.
AllowUsers deploy opsRestrict which user accounts may log in.
AllowGroups sshusers adminsRestrict logins to group members.
Ensure public key authentication is on.
PubkeyAuthentication yesEnsure public key authentication is on.
Point to one or more authorized_keys paths.
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2Point to one or more authorized_keys paths.
Turn off interactive password-style auth methods.
KbdInteractiveAuthentication noTurn off interactive password-style auth methods.
Drop dead sessions after missed keepalive responses.
ClientAliveInterval 60
ClientAliveCountMax 3Drop dead sessions after missed keepalive responses.
Apply options only to members of a specific group.
Match Group sftpusers
ChrootDirectory /srv/sftp/%u
ForceCommand internal-sftp
X11Forwarding no
AllowTcpForwarding noApply options only to members of a specific group.
Host keys, CAs, and host certificates.
sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''Create an Ed25519 host key for sshd.
ssh-keygen -t ed25519 -f ~/.ssh/ca_user -C 'user CA'Create a key pair for signing user certificates.
ssh-keygen -s ~/.ssh/ca_user -I alice@example.com -n alice -V +52w ~/.ssh/id_ed25519.pubCreate a short-lived user certificate from a CA.
Allow user certificates signed by a trusted CA.
TrustedUserCAKeys /etc/ssh/trusted_user_ca_keys.pubAllow user certificates signed by a trusted CA.
Trust host certificates signed by a CA.
@cert-authority *.example.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI...Trust host certificates signed by a CA.