If you want to move away from insecure remote system accessing methods and embrace a streamlined and secure approach, try using SSH. The SSH or Secure Socket Shell is defined as the set of tools for remote connection or data transfers. It is among the most secure ways to access your computer remotely. However, using SSH is not a piece of cake as it requires certain configurations.

This guide allows you to master the SSH and configure it for accessing the remote system securely.

How to Install SSH on Ubuntu 24.04

To install SSH on Ubuntu 24.04, run the below-mentioned command:

sudo apt install ssh -y

How to Enable and Use SSH on Ubuntu 24.04

After installing the SSH on Ubuntu 24.04, enable the SSH using the below-stated command:

sudo systemctl enable ssh.service

Now, check if the SSH is enabled or not, using:

sudo systemctl status ssh

If the Active shows inactive (dead) status, you must start the SSH via the following command:

sudo /etc/init.d/ssh start

Now, enable and configure the firewall to allow incoming SSH connections by executing the below-stated commands:

sudo ufw status
sudo ufw enable
sudo ufw allow ssh

On the remote client (to whom you want to connect), run the below command to view the IP address (used to initiate the connection):

ip a

After setting up the SSH, let’s initiate a connection to a remote system using the below command:

ssh [email protected]

The above image shows that the connection is successful and you can now remotely control the SSH system. To quit the connection, run:


How to SSH Using a Custom Port

By default, SSH uses Port 22 and it can be configured by following the below steps:

Step 1: Create a Backup File of the SSH Config File

First off, create a backup file of the SSH config file so that you can recover it if anything goes wrong

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Note: Use the “mv /etc/ssh/sshd_config.bak /etc/ssh/sshd_config” to replace the backup file in case of any misconfiguration.

Step 2: Specify the Port to Use for SSH

Next, you must specify the port you want to use for SSH. To do that, open the sshd_config file using the below command. After opening the file, remove the “#” before the Port and specify the port number you want to use for SSH (33000 in this case):

sudo nano /etc/ssh/sshd_config

Step 3: Change Firewall Rules

Now, you must change the firewall rules as well. First, delete the existing firewall rules for the SSH using the below command:

sudo ufw delete allow ssh

After that, allow the incoming connections on the specified port (33000 in this case):

sudo ufw allow 33000

Finally, restart the SSH to apply the configurations:

sudo systemctl restart ssh

You can now use the new port for SSH in the following format:

ssh -p 33000 [email protected]

Here, the -p flag specifies the port to use.

Final Words

To enable SSH on Ubuntu 24.04, install it first using the “sudo apt install ssh” and execute the “sudo systemctl enable ssh.service” to enable its service on the system boot. Now check the status of SSH, if it displays Inactive (dead), run the “sudo /etc/init.d/ssh start” to start the SSH service. 

After enabling the SSH, you must configure the port for the incoming connections and allow SSH from the Firewall. Additionally, you can specify a custom port that you can use for SSH. This post has demonstrated the complete process to enable and use SSH on Ubuntu 24.04.