How to disable root on Ubuntu

Warning: The following instructions worked for me however may brick your server. Please find a professional network admin to play around with a live/production server. If something bad happens I am not to blame, you have been warned!

Login as root

Create a new user

adduser bobsmith

Add the user to root

sudo visudo

under this line root ALL=(ALL) ALL add

bobsmith    ALL=(ALL) ALL

Disable Root

sudo nano /etc/ssh/sshd_config

Find and change the following line to

PermitRootLogin no

Restart SSH

service restart ssh

Logout

exit

You should not be able to login as root anymore.