Change user password
Changing the root user's password is an essential task for system security or recovery. Here's a step-by-step guide depending on whether you can log in as root, access through a sudo-enabled account,
If you're already logged in as the root user or can switch to it, follow these steps:
Steps:
Open a terminal.
Run the following command:
passwdYou will be prompted to enter a new password. Enter it, then confirm by typing it again.
After confirming, the root password will be changed.
If you’re logged in as a non-root user but have sudo privileges, you can still change the root password:
Steps:
Open a terminal.
Run the following command:
sudo passwd rootYou will be asked for your user's password to authenticate the
sudocommand.Then, you will be prompted to enter the new root password and confirm it.
Once done, the root password will be changed.
Last updated
Was this helpful?