This is an additional security measure where we prevent direct root logins and instead create a user to login and then use a command ‘su –‘ to gain root privileges.
this’s the step by step ho to do it
1. Create a user and add it to the wheel group, e.g. we want to create a user neonix and give him root privileges.
below commands to create a user.
# groupadd neonix
# useradd neonix –gneonix
# passwd neonix
# “enteryouruserpasswordhere”
# “verifyyouruserpasswordhere”
2. Add user to wheel group.
Use your browser to Login to your WHM panel and click on Manage Wheel Group Users.
You will see the user you just added (neonix). Select the user and click ‘Add to group’.
You will see that the user has been added –
Users Currently in the wheel group root,neonix
You have successfully added a user to the ‘wheel’ group who will be able to ‘su -’ to root.
LOGOUT OF SSH
Before we disable root login, let us check if the user can login and su – to gain root privileges.
SSH into your server as ‘neonix’
Login as: neonix
Password : enteryouruserpasswordhere
su –
password: enter root password here
You have successfully logged in and have root privileges. Now let us disable root login.
3. Disable Direct Root Login
a. Copy and paste this line to edit the file for SSH logins
pico -w /etc/ssh/sshd_config
b. Find the line
Protocol 2, 1
c. Uncomment it (Remove #) and change it to look like
Protocol 2
d. Next, find the line
PermitRootLogin yes
e. Uncomment it (Remove #) and make it look like PermitRootLogin no
f. Save the file Ctrl+X then Y then enter
g. Now you can restart SSH
/etc/rc.d/init.d/sshd restart
Now, no one will be able to login to root with out first logging in as ‘neonix’ and ‘su -’ to root, and you will be forcing the use of a more secure protocol.
Just make sure you remember both passwords!
No comments yet.
RSS feed for comments on this post. TrackBack URL