Single Usermode RHEL7

Published Monday, Jul 9, 2018 by Tony Davis


This post describes how to enter single usermode for Redhat 7.

Modify Boot Settings

At the GRUB 2 type the “e” key to edit the current kernel line

Move the cursor down to the kernel line, this is the line starting with linux16.

On this line remove the rgdb and quiet flags

and then add the following

rd.break enforcing=0

rd.break will break the boot sequence at an early stage before the system boots fully. enforcing=0 puts SELinux into permissive mode.

Once you have made the edits above press Ctrl+x to resume the boot process using the new flags.

The system will continue to boot and you should be dropped into a command prompt if you entered the flags correctly.

Remount Partitions

To edit the filesystem you have to remount it as read/write.

switch_root:/# mount -o remount,rw /sysroot

then chroot to the mounted partition

switch_root:/# chroot /sysroot

System Modifications

Now yo are free to make the modifications to your system, the example below shows you how to reset the root password which is a common reason to go into single user mode.

Change The Root password

sh-4.2# passwd root
Changing password for user root.
New passwd: mypassword
Retype new password: mypassword
passwd: all authentication token updated successfully.
sh-4.2# exit
switch_root:/# exit