Hey peeps. Here’s how to go about disabling root login for a linux cPanel CentOS server.
In this example we’ll assume you want to login as mrsnoopdog before being able to login as root, meaning you’ll need to utilize the ‘su’ command.
First, let’s create ‘mrsnoopdog’:
groupadd mrsnoopdog useradd mrsnoopdog -gmrsnoopdog
Now let’s give ol mrsnoopdog a password!
Enter your pass twice. Put it in a nice secure place.
Now if you’re on a cPanel server, you can login to WHM and add your new user under ‘manage wheel group users’ and add you new user; else, no cPanel, edit ‘/etc/group’ and add your new user, in our case mrsnoopdog, after wheel:x:10:root to look like after wheel:x:10:root,mrsnoopdog.
Now, sit back and say ‘grrrreat’ and sip your Guinness. Ok, back to work…
Let edit the file /etc/ssh/sshd_config and change:
Then issue: service sshd restart
While you’re still in the server, open another shell and test it out before you logout.
If it all fails, visit your WHM with “scripts2/doautofixer?autofix=safesshrestart” behind and it will all go back to normal. 🙂