Published on: July 24, 2014 by George K.
Disable root login is a security measure that can be used on a Linux server.
One of the biggest security holes you could open on your server is to allow directly logging in as root through ssh, because any cracker can attempt to brute force your root password and potentially get access to your system if they can figure out your password.
It’s much better to have a separate account that you regularly use and simply sudo to root when necessary.
# adduser user Set the user’s password # passwd user Add the user to the ‘wheel’ group # usermod -G wheel user
# adduser user
Set the user’s password
# passwd user
Add the user to the ‘wheel’ group
# usermod -G wheel user
Before disabling the root login, login as wheel user on another terminal to ensure that everything is working fine.
Switch back to root user using the su command
# su -
Open the ssh main configuration file in the server
# vi /etc/ssh/sshd_config
Search for the below line:
Modify it and change it to
Now restart the service
Make sure that you are able to access the the server as ssh user and switch to root without closing your current ssh root session.
Category : General, Howtos, Linux