How to Enable SSH on Ubuntu 24.04 System

SSH is the abbreviation for Secure Shell, which provides an encrypted connectivity tool to establish a remote connection between the server and the client. The SSH can encrypt and control all traffic when connected remotely.

Furthermore, SSH provides a safe and secure way to remotely access your machine from another computer system. Therefore, after installing the SSH package, you will also need to enable the SSH service to utilize its functionalities.

Through this guide, you will improve your skills on how to enable SSH on the Ubuntu 24.04 system.

How to Enable SSH on Ubuntu 24.04 System?

You will explore the following topic through this comprehensive post:

Step 1: Update Ubuntu’s Cache Files

Always keep your Ubuntu machine up to date with the latest system files. To do this, you can execute the command:

Update Ubuntu’s Cache Files
Update Ubuntu’s Cache Files

This process will improve your system’s functionality, speed, and performance.

Step 2: Install SSH Package

To utilize the SSH services, install the OpenSSH server and client on your Ubuntu 24.04 system:

Install SSH Package
Install SSH Package

After installing the SSH server and client, you will find a similar message, as mentioned above, on your terminal screen.

Step 3: Confirm SSH Version

To ensure the SSH has been installed on your Ubuntu 24.04 system, run the command:

Confirm SSH Version

The release number of SSH varies from time to time. For instance, the current latest stable version of SSH is 9.6.

Step 4: Enable SSH Service

It is necessary to enable the SSH services to avail the complete services of SSH on your Ubuntu 24.04 machine. The following command is provided for your reference:

Confirm SSH Version

The “–now” option is optional. It enables and starts the SSH service immediately.

Step 5: Verify the Running Status of SSH

You can use the “status” option to check if the SSH service is running correctly on your Ubuntu 24.04 system:

Verify the Running Status of SSH

If you see the same status mentioned above, it shows that you have successfully installed and enabled the SSH services on your system.

Step 6: Enable Firewall

To enable the Firewall specifically for SSH, execute the command:

Verify the Running Status of SSH

This command configures and manages a firewall on your Ubuntu 24.04 system.

Step 7: Allow SSH on the Default Port

After enabling the firewall, you need to allow SSH traffic on the default Port 22 using the command:

Allow SSH on the Default Port

This command ensures remote access to the server on a specific port, such as Port 22.

Step 8: Reload Firewall

Once you have enabled SSH and allowed traffic on Port 22, run the below reload command to apply the changes: 

Allow SSH on the Default Port

As shown above, the Firewall on your Ubuntu 24.04 is now reloaded.

This process enhances the security of your Ubuntu 24.04 system by controlling and managing network traffic.

How to Make a Remote Connection after Enabling SSH on Ubuntu 24.04?

This section provides detailed steps to establish a remote connection using SSH.

Step 1: Make a Remote Connection

After successfully configuring the SSH on your Ubuntu machine, utilize the command to make a remote connection between the Server and Client systems:

Remote Connection after Enabling SSH on Ubuntu 24.04

In this example, we established a connection from the local machine (client) to a remote server (host) with the username “ubuntu” and the IP address 192.168.102.213.

Note: Use the syntax username@IPAddress when connecting to a remote server.

Step 2: Check the Remote System’s Version

You can now operate the remote server from your local machine. For example, run the command to check the currently running release version or Linux distribution of the remote server:

Remote Connection after Enabling SSH on Ubuntu 24.04

The snapshot above shows that the operating system running on the remote server is Ubuntu 22.04.4 (Jammy).

Step 3: Exit from the Remote System

You can exit from the remote system at any time using the following simple command:

Remote Connection after Enabling SSH on Ubuntu 24.04

As mentioned above the “exit” command successfully closed the remote server.

How to Disable SSH on Ubuntu 24.04?

The following commands will be utilized to disable SSH on the Ubuntu 24.04 system.

Step 1: Stop the SSH Service

Run the command to stop both the SSH service and the socket on your machine:

Disable SSH on Ubuntu 24.04

This step is essential to temporarily suspend or stop the SSH service and the socket on your system.

Step 2: Disable the SSH Service

After stopping the SSH services, you also need to disable the SSH service from starting automatically on the system boot:

Disable SSH on Ubuntu 24.04

This simple command disables both the SSH service and the SSH socket.

Step 3: Verify the Current SSH Status

Use the command to verify the current status of the SSH service to ensure it is stopped and disabled on your system:

Disable SSH on Ubuntu 24.04

According to the screenshot above, the SSH services on your Ubuntu 24.04 are successfully stopped and disabled.

How to Remove SSH from Ubuntu 24.04?

You can use the following commands to remove the SSH package and its configuration files from the Ubuntu 24.04 system.

Step 1: Remove SSH Package

The following purging command is a useful command to uninstall and completely remove the packages, such as SSH, from your Ubuntu systems:

Remove SSH from Ubuntu 24.04

This command ensures the complete removal of packages and associated configuration files of the SSH package.

Step 2: Verify the SSH Removal

Let’s verify that SSH has been completely removed from your machine:

Remove SSH from Ubuntu 24.04

If the command returns that SSH is not found, it shows that SSH has been successfully removed from your Ubuntu 24.04 system.

FAQs

What is SSH?

SSH is the abbreviation of Secure Shell. It is an encrypted connectivity tool to establish a remote link between the host/server and the guest/client.

How can I install the SSH on Ubuntu 24.04 system, if not installed?

If the SSH package is installed on your system, you can install it through this simple command:

sudo apt install openssh-server openssh-client

Can I enable SSH services on my Ubuntu 24.04 system using the terminal?

Yes, you can use your Ubuntu 24.04 terminal to enable the SSH services: “sudo systemctl enable ssh –now”.

How to connect to a remote server after enabling SSH on Ubuntu 24.04?

To connect to a remote server, follow this simple syntax:

“ssh username@IPAddress_of_remote_server”.

What is the command to disable the SSH on Ubuntu 24.04 system?

To disable the active status of SSH on your Ubuntu 24.04 system, utilize the command:

sudo systemctl disable ssh.service ssh.socket

Conclusion

You can enable or disable the SSH services on your Ubuntu 24.04 system using simple commands. First, ensure you have installed the SSH package (i.e. sudo apt install openssh-server openssh-client). Then, use the command “sudo systemctl enable ssh –now” to enable the SSH services.

For some reason, you can disable and uninstall the SSH using the command “sudo apt purge openssh-server openssh-client” from your Ubuntu 24.04 system.

Scroll to Top