- Reboot the server
- While you are at boot menu press “Up or Down” arrow key to prevent system from booting.
- Select the boot device and press “e” to edit it.
- Scroll down the program with arrow key, till you see a line starting with “linux16”. That line will have words “rhgb quiet” .(refer Image 1)
- Now change “rhgb quiet” to init=/bin/bash as in image 2.
- After making the change press “ctrl x” to boot the system.
- Screen will now take you to command prompt without asking for password.
mount -o remount,rw /Now execute “passwd” command to change the password of root user. (refer image)
Tip:
- Pick strong password else it will throw error of bad password and may not change the password.
- If you are getting error “passwd command not found” ensure that your machine is booted with the disk and not the ISO. Many people working on VMs make this mistake so you are not alone 🙂
- If you are using SElinux you will have to run this extra relabel step before reboot or else you won’t be able to login with the new password.
touch /.autorelabel
- Finally reboot the server
exec /sbin/initNow you should be able to login with new password.
Hope this post is helpful to you. Do let me know if you have any query.
No comments:
Post a Comment