RHEL 8 / CentOS 8 enable ssh service

The following article will explain how to install and start SSH service on RHEL 8 / CentOS 8 system. SSH is a client-server service providing secure encrypted connections over the network connection.

In this tutorial you will learn:

  • How to Install SSH service.
  • How to start SSH service.
  • How to enable SSH to start after reboot.
  • How to open SSH port 22 for incoming traffic.

Active SSH service and firewall SSH port 22 open on RHEL 8

Active SSH service and firewall SSH port 22 open on RHEL 8.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Redhat 8 enable ssh service step by step instructions

  1. Install the openssh package:
    # dnf install openssh-server
    


  2. Start the OpenSSH service by executing the following command:
    # systemctl start sshd
    
  3. Check the status of the sshd service.
    # systemctl status sshd
    ● sshd.service - OpenSSH server daemon
       Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
       Active: active (running) since Fri 2018-11-16 22:08:39 EST; 1 day 21h ago
         Docs: man:sshd(8)
               man:sshd_config(5)
     Main PID: 979 (sshd)
        Tasks: 1 (limit: 24007)
       Memory: 6.6M
    
  4. Enable the SSH service to start after the reboot:
    # systemctl enable sshd
    
  5. Open the firewall rules to accept incoming traffic on SSH port 22:
    # firewall-cmd --zone=public --permanent --add-service=ssh
    
  6. Connect to the SSH server with IP eg. 10.1.1.1 as the root user from a remote client machine:
    $ ssh root@10.1.1.1