Skip to main content

Disable root account

You might want to disable your root account from logging in.

1. Disable the account (remove password)

$ sudo passwd -d root

2. Lock the account (adds ! to /etc/shadow)

$ sudo passwd -l root

Now logging in as root shouldn't be possible, but you can still elevate to it with sudo su.