Start / Stop / Restart / Reload OpenSSH Server on Ubuntu
Latest version of Ubuntu such as Ubuntu Linux 16.04 LTS or 18.04 LTS and others use the systemctl command to control ssh server on Ubuntu. Older version use the service command. To find out your Ubuntu Linux version, type:
lsb_release -a
cat /etc/*release*
Sample outputs:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
Codename: artful
lsb_release -a
cat /etc/*release*
Sample outputs:
Ubuntu Linux: Start OpenSSH Server
Type the following command:
$ sudo /etc/init.d/ssh start
OR
$ sudo service ssh start
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl start ssh
$ sudo /etc/init.d/ssh start
OR
$ sudo service ssh start
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl start ssh
Ubuntu Linux: Stop OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh stop
OR
$ sudo service ssh stop
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl stop ssh
$ sudo /etc/init.d/ssh stop
OR
$ sudo service ssh stop
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl stop ssh
Ubuntu Linux: Restart OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh restart
OR
$ sudo service ssh restart
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl restart ssh
$ sudo /etc/init.d/ssh restart
OR
$ sudo service ssh restart
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl restart ssh
Ubuntu Linux: See status of OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh status
OR
$ sudo service ssh status
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl status ssh
Controlling sshd using upstart based commands (this syntax is no longer works with the latest version of Ubuntu)
$ sudo /etc/init.d/ssh status
OR
$ sudo service ssh status
OR for systemd based Ubuntu Linux 16.04 LTS or above server:
$ sudo systemctl status ssh
No comments:
Post a Comment