CentOS / RHEL 7 : How to Reset root password

Hey, everyone😀, I am Svastikkka when we are a beginner in Linux or we just started to use Linux operating system we always thought what if we forget the password of our Linux account it may be a root account or any other user-defined account so in here I am going to show that "how to reset the root password of Linux operating system account". Also, it is important for the system administrator to know how to reset the root password.
We consider RedHat operating system (RHEL7) to demonstrate how to reset the root password.

Reset Root Password

Step 1 Restart your system 
Step 2 Press e on your keyboard when you see this screen:


Step 3 If you've done this correctly, you should see a screen similar to this one:




Step 4 Scroll down and find  "linux16" word and use your arrow keys to move to the "linux16" line:




Step 5 In the last "linux16" line append rd.break enforcing=0




Step 6 Press Ctrl-x to start and the system will go in emergency mode.




Step 7 In the emergency mode remount the hard drive with read-write access:  #mount –o remount,rw /sysroot




Step 8 Run chroot to access the system: #chroot /sysroot




Step 9 You can now change the root password: #passwd root





After successful submission, you see authentication is successfully updated 




Step 10 Type exit twice to reboot the system. #exit



Step 11 After successful log out  now you have to enter your new password  for  the root user 



Step 12 Now after successful login open your terminal and type one of the following commands
restorecon /etc/shadow or  touch ./autorelabel



Step 13 Kindly recheck your new password again 😎

If you still face the problem in resetting your root password please checkout the video below.

Comments

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Access and modify all the resources of our Wiki.js using WikiJS API

How to pass parameters in webhook?