How can I manually reset the root password on my Linux virtual server in recovery?
All OnApp versions
- Reboot in recovery.
- Log in via recovery with user/password which is
root/defaultrootpassword. If recovery does not work, try the default root password listed in the properties of the virtual server.
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/xvda(it depends on the distribution). Additionally, it shows the partitions. In most cases, the partition is
Mount the disk. For example, you can create a directory under
and then mount it:
mount /dev/vda1 /mnt/vda1CODE
To make the environment usable,
bind /sys, and
bind /devto this environment:
mount --bind /proc /mnt/vda1/proc mount --bind /sys /mnt/vda1/sys mount --bind /dev /mnt/vda1/devCODE
Change the root to this environment:
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
passwd. Update the password for the root user. The current password is not required.
exitto 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/vda1CODE
cdis a reminder to make sure you are not in the directory which is unmounting.
- Restart the server.