CentOS RedHat 7.x Root Password Reset

Root user is the most powerful user in Linux systems , What if we lost Root Password for any reason and we need to do some troubleshooting or maintenance , you would need root privileges , so you must be able to retain Root Password , Let’s see how to do it ….

01. Reboot Your Linux machine:

Select your boot option and press

01

02. Add rd.break to the line that start with linux16:

You may add rd.break this near the end or any where, it sill stop kernel from normal booting and put it where we can do our simple job .

02

Now Press CTRL+X keys to start

03. Remount , chroot , passwd :

The system root is mounted as read-only but we need it as Read/Write before we chroot to it and change root password.

mount -o remount,rw /sysroot
chroot /sysroot
passwd root
touch /.autorelabel
exit
exit

It may take some time as /.autorelabel will force SELinux to correct any labels , please wait till it done.

03

Now after it finish , system will reboot, use your new Root Password.

That is it , I hope it was simple , Thanks
Enjoy !.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s