Disable Direct Root Login in cPanel

While applying security modifications on the server, one of the most important tweak we should execute is to disable direct root login which will force the hacker to think 2 separate passwords to obtain root access.

Following actions will show you how to turn off direct root login. If you are using cPanel server make sure that you add another user through you can ssh.

adduser admin
passwd admin

Add admin user to the ‘wheel’ group so that you will be able to ‘su -‘ to main, otherwise you may lock yourself out of root.

vi /etc/group
wheel:x:10:root,admin

Copy and paste the following line to edit the SSH login file

vi /etc/ssh/sshd_config

Find the line

Protocol 2, 1

Uncomment it and change it to

Protocol 2

Next find the line

PermitRootLogin yes

Uncomment it and change it to

PermitRootLogin no

Save the file and now you can restart SSH

/etc/rc.d/init.d/sshd restart

Thats it!

 

Leave a Reply

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