How to Install SSH Server on CentOS 7

In this tutorial we are going to learn how to install ssh server CentOS 7 Linux.

SSH Protocol allows users to connect to a remote computer through their computers. It is the Most secure way to access a remote computer through the internet. If you want to connect to your CentOS 7 Server from a remote computer, then you should install ssh server on CentOS 7.

To install ssh server on CentOS 7, We need to install the openssh-server package. Then we need to Configure Firewall to all access to the ssh port 22.

Step One

Install Openssh Server on CentOS 7

The SSH Server for CentOS 7 provides by the openssh-server package which we can install using yum command.

Open the Linux terminal and execute,

yum install openssh-server

This will install the centos ssh server.

How to Install SSH Server on CentOS 7

Start SSH Service on CentOS 7

After the Installation is Finished, Start the centos sshd service using systemctl command.

systemctl start sshd.service

systemctl enable sshd.service

Step Two

Configure CentOS 7 Firewall to Allow SSH Connection

Next, we need to Open the ssh port from the CentOS Firewalld. To open ssh port add following firewall rule using firewall-cmd command and reload the firewall configuration.

firewall-cmd --permanent --add-service=ssh

firewall-cmd --reload

And that is all we have to do. Now you should be able to access your CentOS Server using an SSH Client.

View SSH Server status

Using systemctl status command you can view the status of the CentOS sshd Service.

systemctl status sshd.service

You should get the status of the sshd service as active (running).

systemctl status sshd.service

We can also use netstat command to make sure that our CentOS system is listening on Port 22 which is used by the ssh protocol.

netstat -tulnp | grep ssh

centos 7 netstat ssh server

Summary - Install CentOS Openssh Server

In this tutorial we learned how to install and configure SSH Server on CentOS 7.

  • We installed openssh-server package which provides the SSH server for CentOS Linux.
  • Then We added Firewall rule using the firewall-cmd command to allow access to the CentOS SSH Server.