Linux start sshd (OpenSSH) server command

How do I start sshd daemon (OpenSSH server) on Linux operating system using the command line option?

OpenSSH SSH daemon is called sshd on Linux and used by ssh command. We use ssh and sshd for secure encrypted communications between two untrusted hosts over an insecure network or internet. OpenSSH server listens for connections from clients on TCP port number 22. The server is normally started at boot from /etc/init.d/ssh or /etc/init.d/sshd script. This page explains how to start sshd on Linux using the systemctl command.

ADVERTISEMENTS

Linux start sshd command

  1. Open the terminal application.
  2. You must log in as root.
  3. Use the following commands to start the sshd service:
    /etc/init.d/sshd start
    OR (for modern Linux distro with systemd)
    sudo systemctl start sshd.service
  4. In some cases, the actual script name is different. For example, it is ssh.service on a Debian/Ubuntu Linux. If you are using a CentOS/RHEL/Fedora Linux, use sshd.service name as follows:
    /etc/init.d/ssh start
    OR (for modern Linux distro with systemd)
    sudo systemctl start ssh.service

Start, stop, and restart the OpenSSH server on Linux

You need to execute command as per your Linux distro as described below.

CentOS/RHEL/Fedora Linux

To execute script or sshd service:
sudo systemctl start ssh.service ## <-- Linux start sshd ##
sudo systemctl stop sshd.service ## <-- stop the server ##
sudo systemctl restart sshd.service ## <-- restart the server ##
sudo systemctl status sshd.service ## <-- Get the current status of the server ##
## enable and start sshd at boot time ##
sudo systemctl enable sshd.service
## Is sshd enabled at boot time? ##
sudo systemctl is-enabled sshd.service

RHEL or Fedora or CentOS Linux start sshd command

Start, Restart and Stop the Server on a CentOS/RHEL/Fedora Linux after installation

A note about SUSE and OpenSUSE Linux

The syntax is same as CentOS/RHEL/Fedora Linux. In other words:
/etc/init.d/sshd {start|stop|restart|status}
OR
sudo systemctl {start|stop|restart|status sshd.service}

Debian/Ubuntu Linux

We can run the sshd service as follows:
sudo systemctl start ssh.service ## <-- Linux start sshd ##
sudo systemctl stop ssh.service ## <-- stop the server ##
sudo systemctl restart ssh.service ## <-- restart the server ##
sudo systemctl status ssh.service ## <-- Get the current status of the server ##
## enable and start sshd at boot time ##
sudo systemctl enable ssh.service
## Is sshd enabled at boot time? ##
sudo systemctl is-enabled ssh.service

Debian and Ubuntu Linux Start and Stop the SSHD Server command

HP-UX Unix start/stop/restart sshd

Now, you know start sshd on Linux. But, how do you start sshd on HP-UX? Type following commands as root user:
/sbin/init.d/sshd2 start
/sbin/init.d/sshd2 stop
/sbin/init.d/sshd2 restart

IBM AIX Unix users

Again, ssh and log in as root user and execute the following commands to start, stop, and restart the sshd service:
/etc/rc.d/init.d/sshd start
/etc/rc.d/init.d/sshd stop
/etc/rc.d/init.d/sshd restart

Conclusion

The sshd service starts automatically on Linux after installation and typically enabled and installed during server set up. A script or unit file is installed too, which you can use to start, stop, restart, and find the status of the sshd service. See OpenSSH home page and docs here and the following pages:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 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 VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS

Comments on this entry are closed.

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