Wednesday, July 22, 2015

How to reset root user's password in RHEL7

Problem working with VM's is that you might not use one for a long time and when you had to use it again, you probably won't remember the root user's password! Yeah, ran into that situation myself again today and here are the steps to reset root user's password in RHEL 7. This is a bit different to how we used to do in RHEL 6.x.

1. On the grub menu, press 'e' to enter edit mode.
2. Once in edit mode, look for the line starting with 'linux16', and replace 'rhgb quiet' with 'init=/bin/sh'
3. Press ctrl+x to start booting with the modified grub entries
4. The file system will be mounted in read-only mode. Remount it in rw mode using the below command -  
mount -o remount, rw /
5. Use passwd command to reset the password for root user
6. Execute below command to ensure the selinux contents of modified files are restored properly after reboot -
touch /.autorelabel
7. Execute exec /sbin/init to continue normal boot process or exec /sbin/reboot to reboot the system

Thanks to original poster.

Network unavailability in RHEL7 (VMware) & how did I fixed it.

I was playing around with RHEL 7 evaluation version by firing up a VM lately. One of the issues that I faced was there was no network available other than lo. I ran out of my tricks after almost an hour and finally found the solution in here. Below is what I did to fix the issue -

1. Edited 'Red Hat 7 Eval.vmx'
2. Changed the value of guestOS from "other26xlinux" to "rhel6-64"
3. Added below entry -
ethernet0.virtualDev = "e1000"

Fired up the VM after those changes and voila, it picked the network now. All good!