≡ Menu

HowTo: Restart SSH Service under Linux / UNIX

How do I restart SSH service under Linux or UNIX operating systems?

The command to restart ssh are as follows (you must login as root user). You must run command as per your Linux distro or Unix variant:
restart-ssh-command

CentOS / RHEL / Fedora / Redhat Linux Restart SSH

# /etc/init.d/sshd restart
OR
# service sshd restart
If you are using RHEL/CentOS/Fedora Linux with systemd, enter:
$ sudo systemctl restart sshd

Debian / Ubuntu Linux Restart SSH

# /etc/init.d/ssh restart
OR
# service ssh restart
OR
$ sudo service ssh restart
If you are using Debian/Ubuntu/Mint Linux with systemd, enter:
$ sudo systemctl restart ssh

FreeBSD Restart SSH

# /etc/rc.d/sshd restart
OR
$ sudo service sshd restart

OpenBSD Restart SSH

# /etc/rc.d/sshd restart
OR
$ doas /etc/rc.d/sshd restart

UNIX Restart SSH

# kill -HUP `cat /var/run/sshd.pid`
OR
# kill -HUP $(cat /var/run/sshd.pid)
Please note that the location of /var/run/sshd.pid may change. So just search a bit through /var/run/ directory.

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 1 comment… add one }
  • Matt November 2, 2016, 8:34 pm

    If you are running Raspbian with OpenBSD then you can use:
    $ sudo service ssh restart

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , ,