Enable SSH on Ubuntu, Pop!_OS & Other Linux Distros

Tips on how to enable SSH on Ubuntu, Pop!_OS, and other Linux distributions. Secure Shell (SSH) is a secure communication protocol between a client and a server. Installing the OpenSSH server is one of the primary things we do after setting up a Linux machine. We use Secure Shell to make our administrative tasks easier and manage Linux machines remotely.

If you are interested in tinkering with Linux distributions in your own home lab, be sure to check out our home server build tutorial.

Enable SSH on Ubuntu, Pop!_OS, and Other Linux Distros

Before we enable SSH on Ubuntu or any other Linux distro, we want to first make sure that we have “root” privileges to do so. The default “root” account normally has Super Administrator privileges to install the SSH server.

Open CTRL + ALT +T to open a Terminal Window and type in the following commands one by one to install the Open SSH server package.

sudo apt update 
sudo apt install openssh-server

The above commands will initiate the install process. When a password request is made please type in your “root” user password to continue. If prompted with a Y/N to continue type in Y and press Enter.

Starting the (SSH) Service automatically on Linux

Once installed, the SSH service will start automatically on Linux during boot. If you want to make sure that the SSH service started up properly, initiate the following commands.

 

sudo systemctl status ssh

 

You should now be able to see the OpenSSH Server status as shown below.

The SSH server status should say active: running

Enable SSH on Ubuntu

Creating Multiple Root Users in Linux for SSH Access

We can use the “root” account which already has sudo privileges or we can set up new “root” privileged accounts for multiple admin users.

Below are the steps to create a new user account in Linux and assign them sudo privileges. The newly created users will be able to access SSH while enjoying full root privileges.

Open up a command terminal by pressing CTL+ALT+T as the current root user. Using the command below to create a new user.  You can replace the “username” field with any name you would like to use.

 adduser username

Once an account is created, set a strong password when prompted.

See an example of a sample account we created below called “tesla”

add ssh user ubuntu

Assigning Sudo Privileges To Linux Users

You can use the following command to assign root privileges to new or existing Linux users. Replace the username field with the user’s name to who you would like to assign sudo privileges.

 usermod -aG sudo username

you won’t get a confirmation after this command but you should not see any errors either.

Confirm Sudo Privileges for Linux Users

Once you assign “Sudo” privileges to a Linux user, you can test it out to make sure it is working by using the commands below.

In order to log in using the new account you’ve created, execute the following command.

 su – username

In the example below, we will log in as the user “tesla” which we created earlier.

SSH on Ubuntu

To verify that you are successfully logged in as the intended user, execute the following command.

 whoami 

Here is another popular command to assume the Identity of the root user in  Linux.

The following command allows you to assume the identity of a root user in a session without disturbing the current user’s environment.

 sudo su

Enter the password when prompted and you are in!

You should now be able to run commands such as sudo apt-get update using the newly created account.

You can try these out for yourself

 sudo apt-get update
 sudo apt-get upgrade

We hope this article was helpful and made it easier for you to run administrative tasks remotely via Secure Shell. If you’ve enjoyed this content, please consider subscribing to our Facebook Group @ Tech Really.

WD 6TB Hard DriveOn Sale Now!

Save on Western Digital Red Drives, Perfect for NAS Devices or Servers.

shares