How to Reset Root Password in RHEL 7/CentOS 7 from 9 Simple steps
=================================================
=================================================
Deeply discuss bellow points in this article with related screenshots. If you are a lazy like me simply follow following steps else you are a knowledge enthusiast you can read entire article. 😃💪💪
1. Interrupt boot process once you are in boot loader menu.
2. Select appropriate kernel and press 'e' to shift GRUB.
3.Add 'rd.break' phase to end of linux16 line.(As a best practice use "end" key of keyboard to move end of linux16 line)
4.switch_root:/#
mount -o remount,rw /sysroot/
5.switch_root:/#
chroot /sysroot
6.sh-4.2# passwd
7.sh-4.2# touch
/.autorelabel
8.sh-4.2# exit
9.switch_root:/# exit
=====================================================
Lets move descriptive artical for above steps.
You should reboot your server for resetting your root password.
Once you reboot the server you will have boot loader selection screen.
In here you can see current running kernels and kernel rescuer's there.
In my case there are two option currently running kernel and its kernel rescuer because I
have not updated kernel yet after first installation.
If you have upgrade kernel, you will see several numbers of kernel selections there but default is latest kernel selected.
Once you have above screen, immediately you should interrupt booting process before moving booting process using press keyboard keys.
Then type 'e' for editing the grub file.After press 'e' you can see a screen and you should move your courser using arrow-keys to highlighted line.(linux16 line)
Add 'rd.break' to end of the linux 16 line(As a best practice use "end" key of your keyboard and move to end of line.You want miss the end of line with this case.).
After you've successfully added that phase press ctl + x for save grub changes and switch to sysroot.
Next you will have screen like bellow.
You can changed root password now using 'passwd' command. While you changed password, you will see prompt as following screenshot.
Once you successfully updated your password you need to create autorelabel file for affected changes to next boot time.
Now we almost done the change root password of the server. Now you can exit from chroot shell.
Exit again with switch_root shell. Now you have successfully changed password.
No comments:
Post a Comment