Install ssh server on CentOS 8 / RHEL 8

The SSH server might already be installed on your RHEL 8 / CentOS 8 system. You can check the status of your SSH server using the systemctl status sshd command. We will then install the openssh-server package below by using the dnf command.

In this tutorial you will learn:

  • How to install SSH server onRHEL 8 / CentOS 8.
  • How to open SSH firewall port 22 on RHEL 8 / CentOS 8.
  • How to enable SSH to start after reboot on RHEL 8 / CentOS 8.

Active SSH Server Daemon on RHEL 8 Linux server/workstation.

Active SSH Server daemon on RHEL 8 Linux server/workstation.

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 OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS
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

How to Install ssh server on RHEL 8 / CentOS 8 step by step instructions

  1. Install the SSH server package openssh by using the dnf command:
    # dnf install openssh-server
  2. Start the sshd daemon and set to start after reboot:
    # systemctl start sshd
    # systemctl enable sshd
  3. Confirm that the sshd daemon is up and running:
    # systemctl status sshd
  4. Open the SSH port 22 to allow incoming traffic:
    # firewall-cmd --zone=public --permanent --add-service=ssh
    # firewall-cmd --reload
  5. Optionally, locate the SSH server man config file /etc/ssh/sshd_config and perform custom configuration.

    Every time you make any change to the /etc/ssh/sshd_config configuration file reload the sshd service to apply changes:

     # systemctl reload sshd