This video shows you how to break and reset root password in Linux (RHEL7 & Centos7)
To Reset Centos7 or RHEL 7 Root password:
Step 1: For password reset restart the machine, While restarting the machine , at the grub boot menu press the “ e” key to edit the first boot entry.
Step 2: From the grub options, go to the line that starts with “ linux16”
Step 3: You have to go the end of the line and type “ rd.break” and then press ctrl+x
Step 4: Now the initrampfs prompt with a root shell will appear at this stage, the root file system is mounted in read only mode to /sysroot and it must be remounted with read/write (rw) permission, so enter “ mount &ndash o remount,rw /sysroot”
Step 5: once the file system is remounted , change it to chroot jail so that /sysroot is used as the root of the file system.this can be done by running “ chroot /sysroot”
Step 6: From here the root password can be reset with “ passwd” command.
Step 7: Now we can reboot but, as centos 7 uses SELINUX enforcing mode by default we have to fix the context of the /etc/shadow file so create “ touch /.autorelabel”
Step 8: Now reboot machine and login with new password as root user.
Step 9: Don't forget to subscribe to our YouTube channel for more videos on Linux Administration.