Recover root password or failed mount on a Centos 7 instance

If you need to set the root password or fix a faulty /etc/fstab for example then this is the procedure to access the boot disk without a root password.

Reboot the instance and press "e" when the grub 2 boot menu is shown.

Add the following parameters at the end of the linux16 line

    rd.break enforcing=0

and remove all parameters starting with "console="

Press Ctrl+x to boot

Remount the root filesystem read write

mount -o remount,rw /sysroot


Now you can edit the root disk files under /sysroot.
If you want to set a new password do a change root and set password.

chroot /sysroot


When you are done reboot the instance


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.