How to Enable SSH on Ubuntu


SSH is a secure and encrypted network protocol used for remote login, command execution, and data communication between devices. It ensures secure communication over unsecured networks like the internet, making it an essential tool in Ubuntu and other Linux systems.

With SSH, users can securely access and manage remote systems, execute commands, transfer files, and administer servers. It provides strong authentication and data encryption, protecting sensitive information from unauthorized access and potential eavesdropping. SSH’s importance in Ubuntu lies in its ability to enable secure remote administration, facilitating system management, troubleshooting, and remote collaboration, while maintaining the confidentiality and integrity of the transmitted data.

SSH server is managed through the SSH service on the Ubuntu systems. Enabling SSH on Ubuntu is crucial for secure remote access and administration of systems. It allows administrators to manage servers and devices remotely, enhancing productivity and facilitating efficient troubleshooting without physical access. This post enables you about the methods to enable SSH on Ubuntu, i.e., Ubuntu 22.04.

Prerequisites: Install SSH Server

Before getting into details, ensure that you have installed the OpenSSH server on your Ubuntu system. If not, make use of the following command to install it:

$ sudo apt install openssh-server


After that, you must know the init system your Ubuntu is using to manage the services which can be checked using the command:

$ stat /sbin/init


The yellow highlighted box shows that the “systemd” is the init system which actually uses the systecmtl command to manage the services on the system.

Method 1: Enable SSH on Ubuntu Using Terminal

On Ubuntu, the SSH services (or any other service) is managed through the systemctl command. The systemctl command is a powerful utility in Ubuntu used for controlling and managing the systemd system and service manager. It allows users to start, stop, restart, enable, disable, and manage various system services and units on an Ubuntu system.

Step 1: Check the Current Status

Before enabling the SSH service, let’s check the status of the SSH service:

$ sudo systemctl status ssh


Right now, the service is active but not enabled.

Step 2: Enable the Service

To enable the service, use the command provided below:

$ sudo systemctl enable ssh


This will enable the SSH service on Ubuntu.

Step 3: Verify the Status

You can verify this action via the command:

$ sudo systemctl status ssh


The above screenshots confirms that the SSH service has been enabled on the system.

Method 2: Enable SSH on Ubuntu Using GUI

Apart from the terminal, the SSH service can also be enabled from the GUI of the Ubuntu. Let’s see how it can be done. Open the settings on Ubuntu and go to the sharing option from the left side bar as highlighted below:

Inside the sharing window, you need to ensure, the sharing is enabled which can be done (checked) from the toggle button highlighted below.

Now, you need to turn on the Remote login as shown below:

Upon clicking the remote login, you will see the following window which shows that remote login is enabled which actually refers to connecting using the secure shell.

That’s how you can enable the SSH on Ubuntu via the terminal and the GUI method.

Wrap up

On Ubuntu, SSH is enabled to ensure that after every reboot/login, the SSH service will automatically be started, and you can connect to other machines directly without enabling the service again. The SSH service on Ubuntu can be enabled using the terminal and the GUI method.

The systemctl command uses it enable flag to enable the SSH service on Ubuntu. While for GUI, you have to turn on the sharing inside the settings on Ubuntu. Once sharing is turned on, you have to turn on the remote login which refers to the connections via SSH.

You have learned both the terminal and the GUI method with screenshots to enable the SSH service on Ubuntu. For more interesting tips and tricks on Linux, visit Linux-Genie.

Print Friendly, PDF & Email
Categories
Tags