Skip to content

Instantly share code, notes, and snippets.

@Monmoy042
Last active November 18, 2021 14:47
Show Gist options
  • Save Monmoy042/20cf5c91e0c5716b70dcf6e42e24f3e7 to your computer and use it in GitHub Desktop.
Save Monmoy042/20cf5c91e0c5716b70dcf6e42e24f3e7 to your computer and use it in GitHub Desktop.

Root Password Recover in Linux System

Step-1

First we need to reboot the system.

Step-2

Secondly from the grub boot loader we need to press e from the keyboard. Here e means edit.

Step-3

Now go to end of the line number-4 and write rd.break Note: rd = rescue disk

Step-4

Then press Ctrl+X to load the system

Step-5

switch_root:/# mount -o remount,rw /sysroot
switch_root:/# chroot /sysroot ==>  (Access to the root file system)

Step-6

Here we need to configure the new password for the root user

sh-4.2# passwd ==> Hit enter
Type new password
Retype new password

Step-7

Then write down the commands below:

sh-4.2# touch /.autorelabel ==> SELinux Policiy Relabel
sh-4.2# exit 
switch_root:/# exit
Note: Here we need to wait for a while like 2/3 minutes.

Step-7

Finally login to the system using new password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment