Whether you've forgotten your root password, want to rotate it as a security practice, or received a default password you need to change, this guide covers the process safely.
Changing Your Root Password (If Currently Logged In)
sudo passwd root
Or, if logged in directly as root:
passwd
Follow the prompt to enter and confirm a new, strong password.
Choosing a Strong Password
Use a genuinely long, random password — ideally generated by a password manager rather than something memorable/guessable, especially since root access grants complete control over the server.
If You've Forgotten Your Root Password Entirely
Access your server via your provider's web console (see How to Access Your VPS Console When SSH Isn't Working) using your Client Area login, which doesn't require the server's own root password — then reset the root password from within that session.
Resetting Root Password via Your Provider's Panel
Many providers offer a "reset root password" option directly in the Client Area's server management page, generating a new password without needing existing server access at all — check for this option before assuming you're fully locked out.
Should You Even Use Password Authentication for Root?
Best practice is disabling direct root SSH login entirely and using sudo instead — see SSH Hardening: Change the Port, Disable Root Login & Use SSH Keys. A root password is still relevant for console access even when SSH login is disabled.
Rotating Your Root Password Periodically
Consider periodically rotating your root password as a general security hygiene practice, particularly if you suspect it might have been exposed (accidentally shared, visible in shared documentation, etc.).
Storing Your Root Password Securely
Never store the root password in plain text files, unencrypted notes, or shared documents — use a proper password manager, especially given the complete access this credential provides.
Changing Passwords for Other Users
sudo passwd username
The same command pattern works for changing any user's password, substituting root with the specific username.
Verifying the Change Took Effect
Log out and attempt to log back in (via console, if SSH password auth is disabled) with the new password to confirm it was successfully changed before closing your current session.
Common Errors
"passwd: Authentication token manipulation error" — can indicate a full disk (check with df -h) or a filesystem issue preventing the password file from being written; address the underlying disk/filesystem issue first.
Continue Reading
- How to Access Your VPS Console When SSH Isn't Working
- SSH Hardening: Change the Port, Disable Root Login & Use SSH Keys
- How to Create a New User with Sudo Access on a Linux VPS
Browse more articles in Getting Started / VPS Basics.