This guide will show you how to boot into single user mode on a CentOS 7 server. You'll need single user boot to recover a corrupt file system, reset the root password, ...
First, reboot your server and when you enter the Kernel Selection menu, press
e to modify the parameters to boot the kernel.
The next screen will show you a confusing screen of kernel parameters. It'll look like this.
Scroll down until you find the actual kernel line. It starts with
linux16 /vmlinuz-... and will span a couple of lines. You're now looking for the
ro keyword in the kernel linux, which would start the OS with a read only (ro) file system.
Use your arrow keys to go to the
ro line and replace it with
rw init=/sysroot/bin/bash. The result should look like this. If that's the case, press
ctrl+x to boot the kernel with those options.
If everything went fine, you're now in a limited shell with access to the entire filesystem. To make things easier, you can
chroot the filesystem so you can access all your known files/directories with the same paths.
After you typed
chroot /sysroot/, you'll find your familiar files in
If you're done working in single user mode, reboot again by pressing
Update: as a reader pointed out, you may have to remount the filesystem from readonly to read-write, too.
mount -o remount,rw /
After that, you should be able to make changes to files on the disk that persist on reboot.