Thursday, 28 December 2017

Break Root Password in RHEL or CentOS

  1. Press 'e' at the boot menu





    2. Go to line which starts from linux16  having rhgb quiet with the help of downward arrow key 




   3. Press 'End' key and write rd.break enforcing=0


   4. Then press Ctrl+x

   5. After entering in emergency mode remount root file system in read write mode which is previously in read only mode.

    switch_root:/# mount -o remount,rw /sysroot

  

   6. Once the root file system remounted in read write permission,change into a chroot jail as given below.

   switch_root:/# chroot /sysroot





   7. Now reset the password for root

   sh-4.2# passwd root



   8. Type your new password and also confirm it by retyping






   9. Then press 'Ctrl + d'  two times to exit

   10. After login with new password, open your terminal and type as given   below to restore the security context.

   [root@localhost Desktop]# restorecon /etc/shadow




      

No comments:

Post a Comment