sudo passwd -l root

Category: Self-Hosting

sudo passwd -l root

Lock the root account's password to prevent direct root login — a basic hardening step

Disables password-based root login by locking the root password. Root can still be accessed via 'sudo su' from an admin account.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.