In this post we will learn, how to reset / recover forgotten root password on CentOS 7 / RHEL 7 (Red Hat Enterprise Linux 7). On RHEL 5/6 or CentOS 5/6 series , the method of resetting forgotten root password was same. In latest RHEL 7 / CentOS 7 this time we have found some difference in steps to reset the forgotten root password.
Earlier, root password were used to recover from runlevel in case the boot loader password is not set.
Reset / Recover forgotten root password on CentOS 7 / RHEL 7
Follow the given below procedure to reset forgotten root password.
Step 1: Reboot or start the system, edit grub2
Restart/start the system and on getting GRUB 2 boot screen, first press ESC key so that screen get stopped. Then press e key for editing
Step 2: Initialize the /bin/sh
Now in next screen, scroll down with the help of arrow key and search for any of these two keyword linux16 or linuxefi on UEFI systems.In our case, we have linux16.
Disable rhgb and quiet parameters in order to enable system messages.
In first screenshot you can see, we first scrolldown to line starting with keyword called linux16 . Now remove the parameter rhgb and quiet .
In second screenshot you can see, we have removed the rhgb and quiet parameter
Add the below given parameter at the end of line, to initialize the sh shell.
init=/bin/sh
Now press CTRL with x keyword to boot the system. .
Step 3: Remount / root partition , reset root password and autorelable
The filesystem will be in read only mode, hence run the below given command so that you can write on filesystem
mount -o remount, rw /
Now reset root password with given below command
passwd root
Reconfirm the root password.
NOTE: In case system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error
Now run the below given command for relabeling the SELINUX
touch /.autorelabel
Now restart the system. You can use any one of the command.
exec /sbin/init
OR
exec /sbin/reboot
You will see the system is going to reboot and stuck for a short time. Just wait for a few seconds or minute. Keep pay attention that the screen is stopped when SELIUX relabeling info message appeared on screen.
After a few moment, you will see at the bottom of screen some numerical percentage is running. It states about the completion of selinux relabeling in percentage. After completing 100% , the system will be rebooted.
After successful booting, you can use your new root password for login into system.
That is all!
23 Comentários
Thanks 😉
Thankfulness to my father who told me about this website, this blog is really remarkable.
Thanks 😉
Awesome! Its trulу awesome piece of writing, I have gоt
much clear iⅾea about from this article.
Hello my friend.
Thank you 😉
whoaһ tһis blog is wonderful i ⅼike reading your posts.
Keep up tһe good work! You recognize, a lot of people are ⅼooking around for thіs info,
you can aid them grеatly.
Thank you 😉
Hello! This іs my first visit to your blog! We are
a group of volunteers and starting a new initiative in a community in the same nicһe.
Your blog provided us useful information to wоrk on. Yoս have
done ɑ outstanding job!
Thank you 😉
Ӏ еvery tіme spent my half an hour to read this
web site’s artiⅽleѕ or reviews all the time along with a muց of coffee.
Hello my friend.
Thank you 😉
Have you eѵer consiԀered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.
Nevеrtһeless imaցine if you added some great graphics or videⲟ clips to give your posts
more, “pop”! Your content is excellent but with images and video сlips, this website could undeniably be
one of thе best in its niche. Amazing bloɡ!
Thanks for the tip.
Hi therе are using WordPress for үour site platfoгm?
I’m new to the ƅlog world but I’m trying to get started and set up my own. Do you neеd any coding expertise to make youг own blog?
Any help would be really appreciated!
Hello Friend.
Yes using WordPress and very little change.
No customization as updates make it simpler.
Thank you for writing
It’s reаlly a great and helpful piece of informatіon. I’m glad that you just shareԀ this useful info with us.
Please keep ᥙs informed like this. Thanks foг sharing.
Thanks
Hеy very nice blog!
Hello Guy.
Thank you 😉
Thɑnks for sharing your thօughts. I truly appreciate your efforts and I
am ѡaiting for your next write ups thanks ᧐nce again.
Thank you 😉
Prеtty nice post. I just stumЬled upon yoᥙr weblog and wished to say that I have realⅼy enjoyed
surfing around yoսr blog posts. In any cɑse I wiⅼⅼ
be subscribing to your feed and I hope you write
again vеry soon!
Thank you 😉