Sam Njoroge

Sam Njoroge (carsor007)

Linux engineer/Software Developer

Dallas, TX, Planet Earth (32.7833333,-96.8 - UTC-05)

Recover a forgotten root password on Redhat Linux

Boot up/ restart your server. As soon as the grub menu loads, hit e to edit.

Look for this line, rhgb quiet LANG-en_US.UTF-8 Add rd.break at the end of that line. Then hit ctrl + x to boot into single user mode

  • mount -o remount,rw /sysroot

  • chroot /sysroot

Now you can change the password by typing passwd root and creating new password

  • passwd root–change the password

  • exit

Finally, relable all files when system boots up, this is important so as to maintain due to SElinux contexts

  • touch / .autorelabel#if this is not done passwd change will not be successful ~~~
Post by Avatar Sam Njoroge on
comments powered by Disqus