Linux Applications

How To Restart SSH Service in Linux

The Secure Socket Shell, or SSH, is a widely used utility for controlling servers remotely. It can also be used to operate, monitor, and manage remote machines. SSH uses the cryptographic protocol to establish connections, ensuring safety and privacy.

Although the SSH service becomes active right after installation, you may need to restart it for reasons like configuration changes, system troubleshooting, software updates, etc. This quick tutorial will explain how to easily restart the SSH service in Linux.

How To Restart SSH Service in Linux

Restarting the SSH service (or any other service) is pretty easy. Please follow the steps below corresponding to your version of Linux to do it. You can restart SSH using one of the following commands corresponding to your Linux system:

Operating System Command
Debian/Ubuntu systems having systemd: sudo systemctl restart ssh
Older versions of Debian/Ubuntu systems without systemd sudo /etc/init.d/ssh restart
Fedora/RHEL systems having systemd sudo systemctl restart sshd
Older versions of Fedora/RHEL systems without systemd sudo /etc/init.d/sshd restart
Arch Linux sudo systemctl restart sshd.service
openSUSE sudo systemctl restart sshd

For instance, we will get the following output on entering the above command on Ubuntu:

restart-ssh-service

Finally, let’s verify that the service has become active again. It is a good practice to avoid any errors in your tasks after restarting the SSH service.

sudo systemctl status ssh

check-ssh-status

As it says Active (Running), it means it has been up and running again.

A Quick Wrap-up

SSH is the most widely used utility for operating devices remotely, and it requires the help of the SSH service. However, sometimes, the service can malfunction, and you may need to restart it to resume your tasks. Hence, the approach and commands mentioned above will guide you on how to restart the SSH service in Linux.

About the author

Prateek Jangid