How to enable root user on Linux server

Estimated reading time: 1 min

Introduction

In this article, we will explain how you can enable the root user on a Linux server.

Prerequisites

  • VPS with Linux Operating System installed.
  • You must be logged in via SSH as with a sudo user. This tutorial assumes that you are logged in as a sudo user.

Step 1: Log in using SSH

You must be logged in via SSH with the user in your client area. Please read this article for instructions if you don’t know how to connect.

Step 2: Become root

After a successful login with the user use the following command for becoming root:

sudo -i

Step 3: Set root password

The root user is disabled by default. We have to set a new root password, you can do this as followed:

passwd

It will ask you for a password twice.

Step 4: Enable root remotely

The root user is disabled remotely for SSH you can enable this by editing the following file /etc/ssh/sshd_config. Change the following line:

PermitRootLogin without-password

with

PermitRootLogin yes

Step 5: Reload SSH

To apply the new SSH configuration reload SSH:

systemctl restart sshd

Conclusion

Congratulations, you have enabled the root user on your Linux server.

Was this article helpful?
Dislike 9
Views: 32627

Reader Interactions

Comments

Leave a Reply

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