Disable Root Account on Linux

Windows Articles

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...

How to use CHKDSK in Windows 10

Hello! It is very important to ensure the integrity of the hard disk in the computer. Since it is an essential element for the...

Root is the most powerful user account in Linux system. In fact, it’s the most important part of the entire system that can perform any operation on anything like having a snack. As the root account is this much powerful, it’s always necessary to secure it with proper measures. Using a powerful password is definitely one of them. Learn how to install Ansible on Ubuntu 18.04.

If having a powerful password isn’t enough you think, you’re free to go ahead and disable the root account. Yes, it’s possible to disable root access so that no one can get their hands on it.

Why disable root

There are some conspiracies going around like disabling root account is probably a bad idea because there are a number of actions that has to be performed as root privilege. Disabling root is crazy, right?

This is where the idea is wrong. The truth is, disabling root is definitely one of the best security measures you can pull. This trick is super easy and re-enabling the account isn’t that hard at all.

Disabling Root account

In order to disable the root account, you have to do something beforehand. At first, make sure that all the users in the system having the ability to run commands as root have a secure password. A weak password will reduce the security dramatically.

The best way to do so is to run this command –

# Swap username with the user account
sudo passwd <username>

This command will force reset the user password and will prompt creating a new password. This step isn’t necessary but better safe than sorry, right?

It’s time to disable the root account. Run the following command for starting system-level shell –

sudo -s

Now, simply run the command and disable root –

passwd -l root

This command line will lock the account. However, if your gut sense is telling that you need to secure it even harder, run the next command.

usermod -p '!' root

This command scrambles the root password in an instant. Thus, the root account is inaccessible for all.

Re-enabling the root

Disabling root is a good idea but if you can’t get it back in time, it’s not that safe, right?

Run the following command –

passwd root

Note that after running this command, you have to enter a new password for the account as this command resets root to default.

Voila! Your root account is back again!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...

How to use CHKDSK in Windows 10

Hello! It is very important to ensure the integrity of the hard disk in the computer. Since it is an essential element for the...
x