Interrupt The Boot Process In Order To Gain Access To A System
General Information
If you cannot perform this procedure, you will fail the entire exam.
Recover the root user's password
- Interrupt boot process at grub menu (move an arrow key up or down to stop the grub boot countdown)
- Press “e” to edit the grub menu entry
- Navigate to the line starting with “linux16”; this is the kernel
- Append to the end of the kernel entry (Ctrl+e to go to the end of the line)
rd.break enforcing=0
- rd.break ⇒ stops early in the boot process (when initramfs is in memory and has not mounted the root file system as rw yet)
- enforcing=0 ⇒ set SELinux to permissive mode
- Ctrl+x to continue boot process, it will stop within the initramfs shell
- Remount the sysroot file system as read/write
mount -o remount,rw /sysroot
- Change root to that root file system
chroot /sysroot
- Change root password
passwd
- Exit the chroot jail and initramfs shell
sh-4.2# exit switch_root:/# exit
- The system will continue to boot
- Note: There may be a considerable delay where it looks like nothing is happening, be patient.
- Login as root with the new password
- Restore SELinux file context to /etc/shadow
restorecon -v /etc/shadow
- Set SELinux to enforcing again
setenforce 1