This guide is for resetting the password on CentOS 7 / REHL. Please follow the below steps:
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: rd.break enforcing=0
5. 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.
6. 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.
7. Press Ctrl+X to boot the system with the changed parameters. The switch_root prompt of initramfs is displayed.
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:
switch_root:/# mount -o remount,rw /sysroot
9. Now switch to a chroot environment: switch_root:/# chroot /sysroot
The prompt changes to sh-4.2#.
10. Now you can change the password using the command passwd:
sh-4.2# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Please Note
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.
11. To leave the chroot environment, type the following command:
exit
12. Reboot the server using: reboot
Still need help? Open a support ticket