Main menu

Reset RHEL7 password

Here a’m going to tech you how can you reset RHEL7 password.
In previous versions of RedHat we usually use Single user mode for resetting the password but in newver version or RedHat things are quite different. Since the SELINUX is enable by default and runlevel 1 you have to enter the root password for maintennace it will become different to use the old stuffs here.

Follow these steps to reset RHEL7 root password.

1. Reboot your system and use escap key to prevent system from booting.
2. In the grub menu press “e” to enter in edit mode.
3. In vmlinuz option append the rd.break console=tty1 at the end of line.
4. Press control + x for boot the system with current modifications.
5. you will get swith-root prompt
6. Mount your sysroot with read write option

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

7. chroot your sysroot file system so you can work on it. (like working on sysroot file system).

 switch_root:/# chroot /sysroot

8. set root password

 sh-4.2# passwd root
 New password:
 Retype new password:
 passwd:all authentication tokens updated successfully.

9. selinux is enabled by default in RHEL7 so create a file in root of your system call .autorelabel.

sh-4.2# touch /.autorelabel

10. exit from sysroot and reboot your system.

sh-4.2# exit
 sh-4.2# reboot

Hope this you done it will !!

FacebookTwitterGoogle+RSS