Saturday, July 27, 2024
FeaturedSysAdmin

Enable SSH on Ubuntu 20.04 Focal Fossa Linux + Tutorial Video

Hi sobat Kekasi, now i will give a tutorial How To Enable SSH on Ubuntu 20.04 Focal Fossa Server or Linux Desktop and doing configuration Firewall SSH Port 22. Secure Shell (SSH) is cryptographic network protocol for secure data communication, command-line interface login, remote execution orders, and other network services between two computer networks. So let’s get it started…

How To Activate SSH on Ubuntu 20.04

  1. Install SSH server and client metapackage using apt commands
$ sudo apt install ssh -y

2. Enable and start SSH server daemon:

$ sudo systemctl enable --now ssh

3. Check the SSH server status:

$ sudo systemctl status ssh

4. Check firewall status:

$ ufw status verbose
Status: inactive

If the firewall status is inactive, sobat Kekasi can do the SSH on Ubuntu using ordinary user not root. whereas if the firewal status is active we can move on to the next step which is configuration Firewall SSH port 22 with UFW.

Configuration Firewall SSH port 22 with UFW

For sobat Kekasi who don’t want to use Firewall on Ubuntu, can osdisabling firewall UFW with command:

$ sudo ufw disable

if we want to activateand using Firewall on Ubuntu 20.04 with UFM. Type command:

$ sudo ufw enable

Open port SSH 22 so it can be accessed form the other device. Type command:

$ sudo ufw allow ssh

Or if It is possible to only allow a certain IP address or subnet network to connect through port SSH 22. The following example would allow IP address 192.168.1.2 to connect through port 22. Type command:

$ sudo ufw allow from 192.168.1.2 to any port ssh

This example allow all the subnet network 192.168.0.0/24. Type command:

$ sudo ufw allow from 192.168.0.0/24 to any port ssh

Check all the firewall UFW rules that is currently set. Type command:

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    192.168.0.0/24            
22/tcp                     ALLOW IN    Anywhere                  
22/tcp                     ALLOW IN    192.168.1.2               
22/tcp (v6)                ALLOW IN    Anywhere (v6) 

To remove the rules that is already set on firewall SSh, sobat Kekasi just need to run the same order used to allow SSH port 22 and add the delete option after the UFW command. For example:

$ sudo ufw delete allow ssh
$ sudo ufw delete allow from 192.168.1.2 to any port ssh
$ sudo ufw delete allow from 192.168.0.0/24 to any port ssh

So that is How To Activate SSH and Configuration Firewall SSH on Ubuntu 20.04 Focal Fossa Linux. It is very easy and simple. The next tutorial is How To Allow SSH Root Login on Ubuntu

Tutorial Video

Watch on YouTube

Leave a Reply