How to Install and Configure OpenSSH on Ubuntu 18.04

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 and Configure OpenSSH on your Ubuntu 18.04.

Prerequisites

What is OpenSSH Server?

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 Ubuntu

OpenSSH Server packages are include in the default ubuntu 18.04 repositories.The installation is very easy, just type the following command:

sudo apt install openssh-server

Once the installation is completed, start and enable the OpenSSH Server.

sudo systemctl start ssh
sudo systemctl enable ssh

That`t it, at this point you have openssl-server installed and running on your Ubuntu 18.04 server.

Configuring OpenSHH Server

OpenSSH can be configured by editing the /etc/ssh/ssh_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 remote access.

Open other port for SSH

If you want to Open other port for OpenSSH Server,By following the next steps.

Step 1、Open the /etc/ssh/ssh_configconfiguration file with your text editor:

sudo vi /etc/ssh/ssh_config

Step 2、Find the line Port 22,delete the # char in the line header and change the port number22 to 2200.

.....
Port 2200
....

Save Changes.

Step 3、Restart the OpenSSH Server for changes to take effect:

sudo systemctl restart ssh

Now,the openSSH server port is 2200.

Open remote access port

Ubuntu18.04 comes with a firewall configuration tool UFW.The command below will open the port 2200 and allow acess from client.

sudo ufw allow 2200

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

ssh [email protected]_ubuntu_server_ip -p 2200

Replace username to your ubuntu system user.

Conclusion

In this article,You have learned how to install and Configure openSSH on your Ubuntu 18.07 server.you can try it on you Ubuntu 18.04 server.If you have any questions or thoughts to share, don’t forget to leave a comment to reach us.

Leave a Reply