How to Enable SSH Root Login on Ubuntu

Secure Shell (SSH) is a protocol used to remotely access and manage servers. By default, SSH on Ubuntu is configured to disable root login for security reasons. However, in some cases, you may need to enable root login for administrative tasks. In this guide, we will go through the steps to enable SSH root login on Ubuntu.

Step 1: Login as a sudo user

To enable SSH root login, you need to have sudo access. So, first, log in as a user with sudo access to your Ubuntu server.

ssh [sudo_user]@[server_ip_address]

Step 2: Open the SSH configuration file

The next step is to open the SSH configuration file located at /etc/ssh/sshd_config. Open the file with your preferred text editor. We will use nano in this guide.

sudo nano /etc/ssh/sshd_config

Step 3: Enable SSH root login

In the sshd_config file, find the line containing PermitRootLogin and change its value to “yes”. If the line is commented out, remove the # symbol.

PermitRootLogin yes

Save and exit the file by pressing “Ctrl+X”, then “Y”, and finally “Enter”.

See also  How to Check GCC Version on Ubuntu

Step 4: Restart the SSH service

Now that we’ve made changes to the SSH configuration file, we need to restart the SSH service for the changes to take effect.

sudo service ssh restart

Step 5: Login as root via SSH

Finally, you can now log in as the root user via SSH. Use the following command to log in:

ssh root@[server_ip_address]

Commands Mentioned:

  • ssh – protocol used to remotely access and manage servers
  • sudo – used to gain root or administrative access to the system
  • nano – a command-line text editor for Linux
  • sudo service ssh restart – command to restart the SSH service on Ubuntu
See also  How To Get Email Alerts for SSH Login on Linux Server


Enabling root login over SSH is not recommended as it poses security risks. It is always recommended to use a standard user with sudo access for administrative tasks. However, if you need to enable SSH root login for a specific task, follow the above steps to do so. Remember to disable SSH root login once you have completed the task. This guide has provided a simple and effective way to enable SSH root login on Ubuntu. If you have any suggestions or improvements, please leave them in the comments section below.


Leave a Reply

Your email address will not be published. Required fields are marked *