How can I manually reset the root password on my Linux virtual server in recovery?


All OnApp versions

Linux VSs


  1. Reboot in recovery.
  2. Log in via recovery with user/password which is root/recovery or root/defaultrootpassword. If recovery does not work, try the default root password listed in the properties of the virtual server.
  3. Check for the disk that has the same size as the one which the virtual server has. For example, 50 GB. If there is 49.x GB, this is the one that is needed. Usually, it is /dev/vda or /dev/xvda (it depends on the distribution). Additionally, it shows the partitions. In most cases, the partition is /dev/vda1.

    fdisk -l
  4. Mount the disk. For example, you can create a directory under /mnt for this:

    mkdir /mnt/vda1

    and then mount it:

    mount /dev/vda1 /mnt/vda1
  5. To make the environment usable, bind /proc, bind /sys, and bind /dev to this environment:

    mount --bind /proc /mnt/vda1/proc
    mount --bind /sys /mnt/vda1/sys
    mount --bind /dev /mnt/vda1/dev
  6. Change the root to this environment:

    chroot /mnt/vda1
  7. If you check your pwd (present working directory), you will get /, because you are at the root of this environment now. Double check if you are still root with whoami and run passwd. Update the password for the root user. The current password is not required.

  8. Use exit to leave the environment and go back to the recovery image. Unmount binds and disk:

    cd /
    umount /mnt/vda1/proc
    umount /mnt/vda1/dev
    umount /mnt/vda1/sys
    umount /mnt/vda1

    The command cd is a reminder to make sure you are not in the directory which is unmounting.

  9. Restart the server.