Disable logging into server as root through ssh now! Because any hacker can use
brute force attach to attempt your root password and potentially get access into your server if they can figure out your password.
In this case, solution better is disable login as root and have a separate account that regular to use and simple sudo to root when necessary.
Follow step by step below to disable login root ssh. Befor you begin, make sure you have an account as root.
We will edit in file
sshd_config, this is the main configuration file of sshd service.
# open file
$ vim /etc/ssh/sshd_config
Try to find this selection in the file, make the line look like this to disable logging in through ssh as root.
Finally you’ll need to restart sshd service, now nobody can
brute force attach your server.
$ /etc/init.d/sshd restart
$ service sshd restart
That’s it, happy coding!