How do I restart sshd daemon on Linux or Unix?

I made changed to my /etc/ssh/sshd_config file. How do I restart sshd daemon on Linux or Unix systems?

SSH is an acronym for Secure Shell. It is an Internet communication protocol that allows log into Linux or Unix bases systems and runs commands. One can exchange files using a secure channel over an insecure network such as the Internet. OpenSSH is developed as part of the OpenBSD project and by default installed on modern Linux and *BSD family of operating systems including macOS. This page shows how to restart sshd daemon using the command line option.


Procedure to restart sshd daemon

  1. Open the terminal application
  2. Edit the file /etc/ssh/sshd_config using a text editor such as vi or nano
  3. Restart sshd service on an Ubuntu or Debian Linux using the sudo systemctl restart ssh.service
  4. RHEL/CentOS Linux user run sudo systemctl restart sshd.service

The command to restart sshd varies from one variant of Linux or Unix distro to another. Hence, we will see all other commands below. Please note that you must login as root user to restart services. Either use the su command or sudo command.
Command to restart sshd daemon on Linux or Unix

How to restart the SSHD daemon in Debian / Ubuntu Linux

Type the systemctl command:
$ sudo systemctl restart ssh

CentOS / RHEL / Fedora / Redhat Linux Restart SSHD server

$ sudo systemctl restart sshd

Restating the SSHD daemon on FreeBSD Unix

# /etc/rc.d/sshd restart
# service sshd restart

OpenBSD Unix restart the SSHD service

# /etc/rc.d/sshd restart
# /etc/rc.d/sshd restart

Solaris 10 command

# svcadm disable ssh
# svcadm enable ssh

Solaris version 9 and older users, try:
# /etc/init.d/sshd stop
# /etc/init.d/sshd start

AIX Unix command

# stopsrc -s sshd
# startsrc -s sshd

HP-UX Unix command

To restart sshd daemon on HP-UX, first stop it and again start it as follows:
# /sbin/init.d/secsh stop
# /sbin/init.d/secsh start

Command line SSHD restart for Apple macOS based laptop or desttop

Open the terminal application and type the following two commands
$ sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
$ sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist


This page explained how to restart sshd daemon on Linux or Unix-like operating systems using various command-line options. For more information, see the official OpenSSH documents here. Another option is to read more about ssh client and sshd server by typing the following man command:
man ssh
man sshd

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

2 comments… add one
  • Martin Mar 12, 2008 @ 12:36

    thank you. it was helpful

  • Mr. Bios Nov 13, 2013 @ 13:24

    Can you add command for AIX and HP-UX too?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.