How to Install OpenSSH on CentOS 7

OpenSSH provides server-side daemons and client tools to encrypt data during remote control and file transfer, and thus replace the original similar services.

In this tutorial,we will explain what openSSH is,how to Install OpenSSH on your CentOS 7.

Prerequisites

What is OpenSSH

OpenSSH is a free open source implementation of SSH (Secure SHell) protocol. SSH protocol family can be used for remote control or file transfer between computers. The traditional ways to achieve this function, such as telnet (terminal simulation protocol), RCP ftp, rlogin, rsh, are extremely insecure, and will use plaintext to transmit passwords.

Install OpenSSH on CentOS

OpenSSH Server packages are include in the default CentOS 7 repositories.The installation is very easy,just type the following Command:

sudo yum install openssh-server

Once the installation is completed,start and enable the openSSH service.

sudo systemctl start sshd
sudo systemctl enable sshd

That`s it,at this step you have openssh-server installed and running on your CentOS 7 server.

Configuring OpenSSH Server

OpenSSH can be configured by editing the /etc/ssh/sshd_config file. By default,OpenSSH uses the port 22.In the following sections,we will show you how to configure the openssh server for open other port and SSH access.

Open other port for SSH

If you want Open other port for SSH .By following the next steps.

01、open the/etc/ssh/sshd_config configuration file with your text editor:

sudo vim /etc/ssh/sshd_config

02、Find the line Port 22,delete the # comments in the line header and change the port number to 2200.

Port 2200

03、Restart the openSSH server for the changes to take effect:

sudo systemctl restart sshd

Now,the openSSH server port is 2200.

Open remote access port

CentOS comes with a firewall configuration tool FirewallD.The command below will open the port 2200 and allow access from client.

sudo firewall-cmd --permanent --zone=public --add-port=2200/tcp

Once your firewall is configured ,the next step, you can use ssh command connect to your centos server.

ssh username@your_centos_server_ip -p 2200

Replace username to your centos system user.

Conclusion

You have learned how to install openSSH on your CentOS 7 server.you can try it on you CentOS 7 server.If you have any questions or thoughts to share, don’t forget to leave a comment to reach us.

Leave a Reply