This guide will work for most modern Linux versions like Centos RHEL 7, Debian, Mint, Ubuntu etc...
In Centos 7 the days of editing the "kernel" line and adding "single" are gone. On top of that sometimes after a new install passwords do not work, maybe you forgot your password or for some other reason you need to break in or fix your system? It could also be because you can't mount your root / or some other /etc/fstab error and many other errors.
Reboot your server/computer and keep hitting the "Left Shift" key until you get the GRUB screen like this.
Hit "e" to Edit on the screen below.
Navigate to the first line that starts with "linux" as shown in red.
Move your cursor to the "ro" portion.
For CentOS/RHEL based do this:
Replace "ro" with "rw init=/sysroot/bin/sh" and boot as below and hit "Ctrl+X"
With CentOS you need to chroot to /sysroot, then you can work as you need and expect in the root of the mounted filesystem.
rw init=/bin/bash
*Be sure to erase the $vt_handoff or it will not boot into bash
The boot line should look like this below.
With Mint/Debian/Ubuntu it mounts the root filesystem as you'd expect. With CentOS you need to chroot to /sysroot
Short Version:
1. Edit your grub settings and find the linux16 /vmlinuz and then the "ro" portion.
2. Replace "ro" with "rw init=/sysroot/bin/sh" and boot.
3. Type chroot /sysroot to enter your OS environment to fix/change things.
Long Version:
1.) On bootup edit the bootline by entering GRUB.
Type e
Find the line that says "linux16 /vmlinuz"
Edit the part that says "ro" and change with "rw init=/sysroot/bin/sh"
Hit "Ctrl-X"
Upon bootup type "chroot /sysroot"
password
touch ./autorelabel
exit
reboot
centos, password, resetin, editing, quot, kernel, adding, install, passwords, requirements, installer, bootup, edit, bootline, grub, linux, vmlinuz, ro, rw, init, sysroot, bin, sh, ctrl, chroot, autorelabel, reboot,