Update content

How to change the root password

Reviewed on 19 September 2023Published on 11 June 2021

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.

  1. From the console, launch rescue mode.

  2. Mount your partitions:

    sudo mountall.sh

    The mounted partitions are available in the directory /mnt. This means, you find the partition /dev/sda1 mounted in /mnt/sda1.

  3. Chroot yourself into the root partition:

    sudo chroot /mnt/sda2
  • 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.
  1. 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.


    If you want to reset the password of a user other than root, use the following command, replacing USERNAME with the relevant username. passwd USERNAME

  2. Type exit when you have finished your modifications.

  3. Type the following command to finish:

    sudo umountall.sh && sudo reboot
  4. From the console, click Boot in normal mode to reboot the server.

    Your root password is now changed.

See Also