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

  1. Interrupt boot process at grub menu (move an arrow key up or down to stop the grub boot countdown)
  2. Press “e” to edit the grub menu entry
  3. Navigate to the line starting with “linux16”; this is the kernel
  4. Append to the end of the kernel entry (Ctrl+e to go to the end of the line)
    rd.break enforcing=0
    1. rd.break ⇒ stops early in the boot process (when initramfs is in memory and has not mounted the root file system as rw yet)
    2. enforcing=0 ⇒ set SELinux to permissive mode
  5. Ctrl+x to continue boot process, it will stop within the initramfs shell
  6. Remount the sysroot file system as read/write
    mount -o remount,rw /sysroot
  7. Change root to that root file system
    chroot /sysroot
  8. Change root password
  9. Exit the chroot jail and initramfs shell
    sh-4.2# exit
    switch_root:/# exit
  10. The system will continue to boot
    1. Note: There may be a considerable delay where it looks like nothing is happening, be patient.
  11. Login as root with the new password
  12. Restore SELinux file context to /etc/shadow
    restorecon -v /etc/shadow
  13. Set SELinux to enforcing again
    setenforce 1

  • linux_wiki/interrupt_the_boot_process_in_order_to_gain_access_to_a_system.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)