Reliable control of the SSH server service keeps remote administration available while allowing configuration changes and maintenance windows. Cleanly starting, restarting, or stopping the sshd daemon avoids half-applied settings and reduces the chance of unexpected lockouts during critical work.
On most Unix-like systems, the SSH server is provided by the OpenSSH sshd daemon and managed through init systems such as systemd, System V. Init scripts, or the legacy service wrapper. Each mechanism ultimately controls the same underlying service unit, usually named ssh or sshd, with standard actions for start, stop, restart, status, enable, and disable.
Controlling the SSH server requires root privileges and immediately affects remote sessions when the daemon is stopped or restarted. Remote-only systems should always have an alternate access path in case a configuration error prevents the service from starting again. Service names and unit files differ slightly between distributions, so confirming whether the local system uses ssh or sshd as the service name avoids confusing errors.
Related: How to test SSH server configuration
Related: How to configure the log level for an SSH server
| Method | Command |
|---|---|
| System V. Init scripts | /etc/init.d/ssh [start|restart|stop|status] |
| Systemd | systemctl [start|restart|stop|status|enable|disable] ssh |
| service command | service ssh [start|restart|stop|status] |
Some distributions use sshd instead of ssh as the name of their init script.
$ sudo service ssh stop
$ sudo systemctl start ssh
$ sudo systemctl enable ssh Synchronizing state of ssh.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable ssh
Enabling the unit ensures sshd is started whenever the system reaches the multi-user target.
$ sudo systemctl disable ssh Synchronizing state of ssh.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install disable ssh Removed "/etc/systemd/system/sshd.service". Removed "/etc/systemd/system/multi-user.target.wants/ssh.service". Disabling 'ssh.service', but its triggering units are still active: ssh.socket
Disabling the SSH service prevents automatic startup after reboot and can block remote logins until the service is manually started.
$ sudo /etc/init.d/ssh restart Restarting ssh (via systemctl): ssh.service.
Restarting applies configuration changes by stopping and starting the sshd daemon in a single operation.
$ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/usr/lib/systemd/system/ssh.service; disabled; preset: enabled)
Active: active (running) since Sat 2026-01-10 12:25:38 +08; 3ms ago
##### snipped #####
State active (running) indicates a healthy sshd daemon that is ready to accept incoming connections.