Disable Root SSH Login on Linux Dedicated server
As per the saying “prevention is best then cure” you’ll discover however. Permitting direct logging in as root through ssh is one in all the most important security threats for your server. Reason as a result of any cracker will commit to break your root password and potentially they’ll access your account if they manage to find out your password. Thus its better to create a separate account that you just will use often and easily sudo to root once its required. 1st of all make sure you have got an regular user account and you have got permissions of su or sudo to root from there.
To solve the problem you’ll have to be compelled to edit the ssh_config file. This file is the most configuration file for the sshd service. Generally you’ll find the file in /abc/ssh/, but is could differ also. whereas you’re logged on as root open the file up.
vi /etc/ssh/sshd_config
In this file there will be section reading “PermitRootLogin”
#LoginGraceTime 2m
#PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
Change the line and make it look like this in order to disable logged in through ssh as root.
PermitRootLogin no
For the last step restart the sshd service:
/abc/init.d/sshd restart
Its all done, now nobody can force in for root login.