Need to change the root password in Ubuntu? Here's the step-by-step guide for 2026, including reset methods and security tips.
Quick Method:Open terminal → sudo passwd root→ Enter new password twice.
sudo passwd root⚠ If you forgot the root password:
mount -o remount,rw /passwd rootrebootTo allow root login via SSH:
sudo passwd -u rootTo block root login (recommended):
sudo passwd -l root| Rule | Recommendation |
|---|---|
| Length | Minimum 12 characters |
| Complexity | Uppercase + lowercase + numbers + symbols |
| Avoid | Dictionary words, birthdays, "password123" |
| Manager | Use password manager (generate random) |
Run admin commands with sudo instead of logging in as root.
Edit /etc/ssh/sshd_config → Set "PermitRootLogin no".
Run sudo visudo→ Add "Defaults timestamp_timeout=10".
Ubuntu disables root by default. There is no default password — you must set one.
No! Use a regular user with sudo privileges. Root is for system maintenance only.
Ubuntu blocks root SSH by default. Use a sudo user and run "su -" to become root.