Ubuntu 20.04 Ssh Server Install



Download and burn Ubuntu ISO. Select your USB drive. Select the Ubuntu 20.04 LTS. While OpenSSH client is installed out-of-the-box, you can do following steps to install and setup OpenSSH server in Ubuntu 20.04. First open terminal and run command to install the packages: sudo apt install ssh.

SSH, also known as Secure Socket Shell or Secure Shell, is a cryptographic protocol that helps to encrypt communication in unsecured networks where an SSHD is the daemon program for SSH. Together they provide secure communication between two untrusted hosts over an insecure network.

Step 1 : To install it in Ubuntu, use the following command:

Step 2 : You may check its status by running command:

Step 3 : We’re going to edit a /etc/ssh/sshd_config file using the vi editor as the root user, so you should type the following command on the terminal:

Step 4 : Look for a line that contains PermitRootLogin and replace it with the following line:

Step 5 : Save the /etc/ssh/sshd_config file

Step 6 : Now it’s time to restart the SSH server. Then your server will be installed, configured, and ready to use. You can test this by executing the following command:

Step 7 : You can test your SSH server by trying to connect to it and typing on the terminal the following command:

Step 8 : Now you will see a message asking for your authorization. Type yes and your password. You’re now connected to your our server through the SSH protocol.

Openssh Ubuntu 20

Simplifying SSH connections with a config file

Step 1 : A local configuration must be stored in the .ssh directory of your home directory, and be named config. The full path would look something like this:

Step 2 : This file doesn’t exist by default, but if it’s found, SSH will parse it and you’ll be able to benefit from it. Go ahead and open this file in your text editor, such as nano:

Step 3 : This config file allows you to type configuration for servers that you connect to often, which can simplify the SSH command automatically, for example:

Step 4 : SSH connections with a config file

Ubuntu 20.04 Ssh Server Install Windows 10

In this post I explain how to install Ubuntu Server 20.04 LTS from a USB drive, how to properly set up the BIOS of your home server, how to easily access your Linux server from a Windows machine, and discuss the basic monitoring tools that I like to install on any new server.

This tutorial is aimed at beginners and does not cover more in-depth topics such as installing SSH keys or setting up a firewall. If you are interested in these topics then go to my next post!

Prerequisites

  • A computer which you want to dedicate as server
  • An empty USB drive

1. Download and burn Ubuntu ISO

First, download the Ubuntu ISO from here: https://ubuntu.com/download/server

Install

Then download a small utility which allows you to burn the ISO to a USB drive: https://rufus.ie/

  • Run Rufus.exe
  • Select your USB drive
  • Select the Ubuntu 20.04 LTS ISO
  • You can change the volume label if you want to
  • Click on START

2. Configure your BIOS

Before continuing with the installation of Ubuntu Server 20.04 LTS on your machine, you should set up a few options in the BIOS of your server. Most importantly, check whether all RAM sticks are properly recognized and if your CPU temperatures are in check.

  • Set up your fan curves
  • Make sure to select the correct primary graphics adapter: Either onboard or PCIe depending on whether you have a GPU installed or not (found under northbridge configuration on my board)
  • Set your server to power on after power loss (found under southbridge configuration on my board)
  • Enable boot from LAN (listed under boot on my board)
  • Modify boot order to boot from USB drive first!

3. Install Ubuntu Server 20.04 LTS

Make sure to unplug your USB drive from the server after hitting “REBOOT” as otherwise you will go into an infinite loop of installing Ubuntu over and over again!

You should now be able to log-in on your server using the username and password specified during the installation procedure.

4. Setting up your router

I personally prefer not needing to connect a mouse, keybard, and monitor to my home server and rather administrate it from my Windows machine.

To this end, we need to configure a few things in our router’s settings. Enter 192.168.1.1 or whatever the default gateway of your router is (you can generally find this information on a sicker attached to the back of your router) and log in (again, login credentials are often found on your router).

Go to the network configuration and make sure that you always assign the same local IP address to your home server. This is important, because we want to use this IP address when we connect to our server from another computer in our network.

Additionally, if you want to be able to adminstrate your server from outside of your home network, you need to port-forward port 22 to your home server.

Port forwarding the default port (22) for SSH is not considered to be best practice. This can open your server to brute force attacks on your server. I will explain how to set up a different port and how to properly secure your home server in my next post!

5. Access server from Windows

In order to access my home server from Windows, I like to enable the WSL (windows subsystem for Linux) and use the Windows Terminal app.

Here’s a tutorial on how to install WSL on your Windows machine: https://docs.microsoft.com/en-us/windows/wsl/install-win10

Install Ssh Server Ubuntu 20

You can log-in to your server using the following command:

where <username> is the username which you have just set up above and <ip_address> your server’s local IP address.

Alternatively, you can also set up an alias, which lets you ssh to your server much more conveniently

6. Initial server setup

The first steps you should take after installing Ubuntu Server 20.04 LTS is to update your server

Additionally, I like to completely remove snap since I prefer to install my applications the regular way (this step is optional). For this, first list all installed snaps

then remove all snaps, uninstall snapd, and remove any remaining snap directories.

Make sure to uninstall the snap core least in order to avoid any issues while uninstalling snapd


7. Monitor temperatures

Finally, here are a few useful tools that allow you to monitor your servers CPU and HDD temperatures.

First, install lm-sensors and detect available temperature sensors

There will be a bunch of questions that pop up during <sensors-detect> which you should all answer with yes.

Next, reboot your system

Now you can type <sensors> in order to get a load of information on your systems temperatures

Ubuntu 20.04 Install Ssh Server

To monitor your hard drive temperatures, install hddtemp

Next, get the drive identifier for any hard drive you want to check by typing

Can't Ssh Vm Ubuntu

and then finally get the temperature readings for that drive using

Install Ssh On Ubuntu 20

And that’s it! Your Ubuntu Server is up and running an you can start installing software and go ham. Have fun in the world of endless possibilities of Linux 🙂