If you have a server that’s available over a network it’s generally a good idea to disable root access over ssh.
The reason for this, is that, scripts run attempting to access your server and these scripts use the root username to try and log in. A simple way to protect yourself is to simply disable root access via SSH.
We will first create a standard user account that we’ll use to administer our system.
Run the command:
Next we’ll set a password for the user
Now let’s give the account admin permissions:
Add the following line to the file:
darren = ALL=(ALL) ALL
Now lets stop root from accessing the server via ssh:
Edit the line:
To make it read:
Now restart SSH:
service sshd restart.
Next make sure your you can ssh into the account you created:
Run a command with sudo to insure you have sudo access
Once you have confirmed you can exit the server knowing that root access is now disabled for the server.