This guide is for resetting the password on CentOS 7 / REHL. Please follow the below steps:
- Open the KVM console from your Zare Manager area
- Restart the server and press the "e" key in the GRUB start menu to edit the start entry.
- Remove the parameters rhgb and quiet from the line beginning with linux16.
- Add the following parameters at the end of the Linux16 line:
- Press Ctrl+X to boot the system with the changed parameters. The switch_root prompt of initramfs is displayed.
- Since the file system is mounted under /sysroot/ with read-only permissions, you must first remount it with write permissions:
- 9. Now switch to a chroot environment:
- Now you can change the password using the command passwd:
- To leave the chroot environment, type the following command:
- Reboot the server using;
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.
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.
switch_root:/# mount -o remount,rw /sysroot
switch_root:/# chroot /sysroot
The prompt changes to sh-4.2#.
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.