Steps to Disable the Root Account in Linux

Disable the Root Account in Linux

In this article,i have sharing with you another security tip to secure your server.

In my previous articles, I have shared the detail information about securing the server and also shared the tips to secure Linux machines or servers.

If you want to know or learn more about the server security then go through my previous articles

 

Read : 5 Simple Security Measures to protect server
Read : Set Email Alert SSH Login On Linux Server

 

Now come to the current article. Here I will share one more security related article which is based on disable the root account on the machine. You have already know that any hacker can hack your system through brute force attack on SSH root account and possibly get access on to your system.

You have already know that any hacker can hack your system through brute force attack on SSH root account and possibly get access on to your system.

It is good to use another account to login on the server then do sudo to have root access. Before start with this steps make sure you have a normal user account and then you can sudo to root from it. If you are new to Linux and not having an idea to create a regular account then go through the

Before start with this steps make sure you have a normal user account and then you can sudo to root from it. If you are new to Linux and not having an idea to create a regular account then go through the

If you are new to Linux and not having an idea to create a regular account then go through the below provided link. This will help you to create regular user account on system.

 

Read : Normal User SSH Access On Linux

 

Now to fix the root account problem, you will need to make some changes to the "sshd_config" file. This is the main configuration file of SSH. "sshd_config" file basically, resides under the "/etc/ssh" directory.

First logged on a server with root user and open the "/etc/ssh/sshd_config" file.

vim /etc/ssh/sshd_config

##Now check for the line "PermitRootLogin" and uncomment this line which is by default commented in the file.

PermitRootLogin no

Save and close the file.

After saving the configuration file you will need to restart the SSH service.

/etc/init.d/ssh restart

Now logout from root account and check again with root login. It will not allow you to login as root user. So Login with the regular user and then do sudo to root account.

I hope you like the article if you find any difficulties to disable the root account then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.

 

Read : 5 simple steps for key based authentication SSH

Leave a Reply

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