RedHat/CentOS : Install and configure SSH

What is SSH?

SSH is known as Secure Socket Shell and is used to secure network services over an unsecured network. SSH encrypts all communication between client and server systems including passwords. Every packet transmitted is encrypted with a key known only by the remote and local systems. Any network service can be secured with SSH, typical applications using SSH is remote command execution and remote command-line login.

Check which version of SSH is installed:

By default, SSH is usually installed.

ssh -V

Login as root:


Install SSH:

yum install openssh
yum install openssh-server

Change ssh default port:

This step is optional for added security. Configure ssh with vi and modify the default ssh port.

vi /etc/ssh/sshd_config

Add the following lines to your ssh config.

#ssh port
port 2563 #add your port number of choice here depending on your network best practices

Start ssh service:

systemctl start sshd

Configure the system to automatically start ssh on boot:

systemctl enable sshd

Allow ssh service through the firewall:

SSH (port22) service is allowed through the firewall by default. If you change the default ssh port you should add the new port to the firewall configuration:

sudo firewall-cmd --permanent --remove-service=ssh
sudo firewall-cmd --permanent --add-port=2563/tcp
sudo firewall-cmd --reload

You’re all set. You can log in to your remote server with a terminal client like putty:

Chad Crouch

Chad is an experienced systems administrator with exposure to various technologies and enterprise ICT environments. He has a huge passion for technologies, specifically Linux, open source software, electronics, and IoT technologies. If you enjoy our articles please support us and make a small contribution: Buy Us A Coffee