Restarting the SSH server service applies daemon changes that cannot wait for a reboot. Because sshd is the access path for remote administration, test the configuration first and keep a working shell or console available until a new login succeeds.
On systemd Linux hosts, the packaged OpenSSH server unit is usually ssh.service on Debian and Ubuntu, while some distributions expose sshd.service. The systemctl restart action stops and starts the unit, and systemctl is-active confirms whether the daemon returned to the running state.
A restart is stronger than a reload and can interrupt new connection attempts while the listener is recreated. Use it after package upgrades, daemon failures, or configuration changes that a reload cannot apply; for routine configuration edits, run sshd -t before touching the service and verify a fresh login from a separate client afterwards.
Keep an existing SSH session or console path open until the restart completes and a new login works.
$ systemctl list-unit-files ssh.service sshd.service --no-pager UNIT FILE STATE PRESET ssh.service disabled enabled sshd.service alias - 2 unit files listed.
Use ssh in later commands when ssh.service is the real unit; use sshd when the host provides sshd.service as the real unit.
$ sudo sshd -t
No output means the active server configuration parsed successfully and the configured host keys passed the sanity check.
Related: How to test SSH server configuration
$ sudo systemctl restart ssh
Replace ssh with sshd if the unit discovery step showed sshd.service as the real unit.
Related: How to manage the SSH server service with systemctl
$ systemctl is-active ssh active
On socket-activated Ubuntu systems, ssh.service can show disabled for boot enablement while ssh.socket keeps the listener available.
$ sudo ss --tcp --listen --numeric --processes 'sport = :22'
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 4096 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=220,fd=3),("systemd",pid=1,fd=51))
LISTEN 0 4096 [::]:22 [::]:* users:(("sshd",pid=220,fd=4),("systemd",pid=1,fd=53))
Change :22 if the server listens on a custom Port value.
$ ssh user@host.example.net 'echo SSH service restarted' SSH service restarted