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!
1. Login as root
ssh root@ipaddresss
2. Create a new user
adduser bobsmith
3. Add the user to root
sudo visudo
4. under this line root ALL=(ALL) ALL add
bobsmith ALL=(ALL) ALL
5. Disable Root
sudo nano /etc/ssh/sshd_config
6. Find and change the following line to
PermitRootLogin no
7. Restart SSH
service restart ssh
8. Logout
exit
You should not be able to login as root anymore.
Recent Comments