-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRhel reset password
More file actions
16 lines (15 loc) · 1.38 KB
/
Copy pathRhel reset password
File metadata and controls
16 lines (15 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Interupt the boot while pressing the down arrow key
Find the line that refers to the kernel: There will be a series of 'boot parameters' here: these are instructions passed during the loading of the kernel.
a) For RHEL/CentOS 7, the line starts with 'linux16'.
b)For RHEL/Centos 8x, and Fedora the line starts with 'linux'.
select from above then press e for edit then Add 'rd.break' at the end of that line
Now hit Ctrl-x to run the edited bootloader script.
You’ll boot to a 'rescue' prompt that looks like this: switch_root:/#.
Remount the root partition in read-write mode so that you can run commands. Enter the following: mount -o remount rw /sysroot and then hit ENTER.
Now type chroot /sysroot and hit enter. This will change you into the sysroot (/) directory, and make that your path for executing commands.
Now you can simply change the password for root using the passwd command.
Next, before you reboot, you will need to make sure that SELinux allows the file changes. At the prompt ,enter: touch /.autorelabel.
This will signal SELinux on the next reboot that the filesystem has changed (the changed password)
and allow the change to be loaded. This will cause the whole filesystem to be 'relabeled' which might take a while,
depending on the size of the filesystem and the speed of the machine, so be aware of this possibility.
Type exit to leave the chroot environment and enter reboot.