|We moved this page to our Documentation Portal. You can find the latest updates here.|
How can I manually reset the root password on my Linux VM in recovery?
OnApp All Versions
- Reboot in recovery.
- Login via recovery with user/password being root/recovery or root/defaultrootpassword <-- could be either one, depends on if it was able to set it to the default one or not. If recovery does not work, try the default root password listed in the properties of the virtual machine.
fdisk -lTo check for the disk that has the same size as the one this VM has. ex: 50GB, you'll probably see 49.something GB here, but that's the one. Normally it's /dev/vda or /dev/xvda (depends on the distribution). It will also show the partitions, and it will more than likely be the /dev/vda1 partition.
- Mount that disk. For example, you can create a directory under /mnt for this:
mkdir /mnt/vda1and then mount it like this:
mount /dev/vda1 /mnt/vda1
- To make that environment usable, bind /proc, /sys, and /dev to that environment:
mount --bind /proc /mnt/vda1/proc
mount --bind /sys /mnt/vda1/sys
mount --bind /dev /mnt/vda1/dev
- Now 'change root' to that environment:
- If you check your
pwd(present working directory), you'll have / because you're in the root of this environment now. Double check you're still root with
whoamiand then you can run
passwdand update the password for the root user. It will not ask for the current password.
exitto leave the environment and go back to the recovery image. Unmount binds and disk
cd /The command cd is there as a reminder to make sure you're not in the directory you're unmounting or it won't unmount.
- Restart the machine and it should allow you in with the password you've set it to.