Reset Centos 7/REHL Password - Single User Mode

This guide is for resetting the password on CentOS 7 / REHL. Please follow the below steps:

  1. Open the KVM console from your Zare Manager area
  2. Restart the server and press the "e" key in the GRUB start menu to edit the start entry.
  3. Remove the parameters rhgb and quiet from the line beginning with linux16.
  4. Add the following parameters at the end of the Linux16 line:
  5. rd.break enforcing=0

    The parameter rd.break causes the boot process to be interrupted before initramfs passes control to systemd. Thus, the initramfs prompt can be used for command entry. The parameter enforcing=0 puts SELinux into permissive mode. This saves the later (and possibly very time-consuming) relabelling of the file system, which would be necessary when SELinux is switched off.

  6. Press Ctrl+X to boot the system with the changed parameters. The switch_root prompt of initramfs is displayed.

  7. Please Note, If the file system is encrypted, the prompt for entering the password may be overlaid by the system messages, making it no longer visible. If this is the case, briefly press the Backspace key. The prompt should be displayed again.

  8. Since the file system is mounted under /sysroot/ with read-only permissions, you must first remount it with write permissions:
  9. switch_root:/# mount -o remount,rw /sysroot
  10. 9. Now switch to a chroot environment:
  11. switch_root:/# chroot /sysroot

    The prompt changes to sh-4.2#.

  12. Now you can change the password using the command passwd:
  13. sh-4.2# passwd

    If passwd aborts with the message Authentication token manipulation error, you have to leave the chroot environment again and remount /sysroot - as described in the previous step - with write permissions.

  14. To leave the chroot environment, type the following command:
  15. exit
  16. Reboot the server using;
  17. reboot

Still need help? Open a support ticket

Got any questions? Contact us today.