LinuxTutorialsUbuntu

How To Install SSH Server on Ubuntu 18.04 LTS

Install SSH Server on Ubuntu 18.04

In this tutorial, we will show you how to install SSH Server on Ubuntu 18.04 LTS. For those of you who didn’t know, SSH provides a secure encrypted connection between a client and a server over an insecure network, protecting against password interception and other attacks. It’s widely used by system administrators and developers for remote server management, file transfers, and tunneling other applications over an encrypted channel.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the SSH Server on an Ubuntu 18.04 (Bionic Beaver) server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 18.04 and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install SSH Server on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, recommended updating your system’s package index and upgrading installed packages to their latest versions:

sudo apt-get update
sudo apt-get upgrade

This step ensures you have the latest security patches and bug fixes, minimizing potential compatibility issues during the installation process.

Step 2. Installing SSH Server on Ubuntu 18.04 LTS.

Ubuntu 18.04 LTS includes the OpenSSH server package in its default repositories, making the installation process straightforward. Open your terminal and run the following command to install the OpenSSH server:

apt-get install openssh-server

Furthermore, you can install the OpenSSH client application using the following command:

apt-get install openssh-server

After that, you should have SSH service enabled in your system:

systemctl start sshd.service
systemctl enable sshd.service

The last step is to open up the ssh firewall port:

ufw allow ssh
ufw reload

Verify the changes by checking the firewall status again:

sudo ufw status

The output should show that the SSH port is now allowed:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

Step 3. Advanced Configuration SSH Server.

The SSH server configuration file (/etc/ssh/sshd_config) contains various options to customize the server’s behavior. While the default settings are generally secure, you may want to review and modify certain options based on your specific requirements.

Open the configuration file using a text editor with sudo privileges:

nano /etc/ssh/sshd_config

The first thing you may want to do is to change the default SSH listening port. Open the file and locate the line that specifies the listening port:

Port 22

Change it to something else. For example, to 323:

Port 323

Save the file and close it. Then restart the service for the changes to take effect:

systemctl restart sshd.service

Congratulations! You have successfully installed OpenSSH. Thanks for using this tutorial for installing SSH Server on your Ubuntu 18.04 LTS (Bionic Beaver). For additional help or useful information, we recommend you check the official OpenSSH website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button