How to change the root password
This document shows you have to change your password using the rescue system. If we then try to use the usual
passwd command to change the password, you will only change the password of the rescue system. After a reboot your modifications will be reset. We therefore show you how to access your real files in order to change your password.
From the console, launch rescue mode.
Mount your partitions:
The mounted partitions are available in the directory
/mnt. This means, you find the partition
Chroot yourself into the root partition:
sudo chroot /mnt/sda2Note:
- If you installed your server with the default partition layout, the root partition will be mounted on sda2.
- If you configured custom partitioning, your root partition may be mounted elsewhere.
Use the following command to change the password:
You will be prompted two times to set the new password. While you are writing, nothing will appear on screen. This is a normal security measure.Tip:
If you want to reset the password of a user other than root, use the following command, replacing USERNAME with the relevant username.
exitwhen you have finished your modifications.
Type the following command to finish:
sudo umountall.sh && sudo reboot
From the console, click Boot in normal mode to reboot the server.
Your root password is now changed.