The SSH (Secure Shell), is a network protocol that used to operate remote logins to distant machines within a local network or over the Internet. We are going to install SSH on CentOS and connect it via remote computer.
By default, the SSH installed and ready to use in CentOS 8 and Linux Red Hat Enterprise. In case you need to install and configure it, this is what you should do to install and enable SSH on Red Hat and CentOS.
The same process works for all Linux distro, but you need to use YUM for Red Hat-based distro and APT for Debian distro. Read more about APT and YUM in Linux command line section.
Check the status of SSH before installing on your Linux computer.
Sudo systemctl status sshd
The output results indicate the status of SSH as green Active and running. You can connect remotely via another computer over the internet or local network.
Related article: Enable SSH on CentOS and Red Hat Enterprise
Install SSH on CentOS 8.x Linux
In a case when you what to install and enable SSH on CentOS or Red hat Linux, follow these steps to install and configure SSH securely.
So good, after updating your system just type the following command to install SSH server.
sudo yum -y install openssh-server
The command result should be a complete installation process, and it set up all the necessary files for the SSH server.
Let’s check the newly installed SSH server with running the following command.
systemctl status sshd
The SSH is installed but not running. You can start the SSH server by running the following command.
sudo systemctl enable sshd
Now the SSH server is enabled, execute the following command to run it.
sudo systemctl start sshd
Great! The SSH server is up and running. Let’s connect to this server via another computer.
Find the Linux CentOS IP address with following command.
ip a s
My CentOS machine IP address is 192.168.1.120. Your might be different!
I’m testing SSH connection via Windows 10 machine using Windows PowerShell command line. You can use the terminal on Mac OS or Linux.
Type the following command to connect to CentOS Linux remotely using SSH.
Yes, we’ve successfully connected to the CentOS machine remotely using SSH.