How to reset Linux root password – CentOS

Well, I am not a hacker and I never try to be a Hacker but Last Network Engineer resigned and one of our Linux CentOS VM was there but we don’t know its password and even don’t know what role this CentOS VM is playing in our Infrastructure or Network. I have reset its root password and trying to write this post in easy to understand way for people like me!
One thing that people ask that what about “counter-measures” for this? Do remember that you cannot perform this action remotely; you must have access to physical system / VM etc. In simple words, you must be “You must be working on console, not remote”. 
  • Reboot Linux CentOS / RedHat / Fedora Server.
  • Once you Server rebooted and on below level, Press “e” from you keyboard. Pressing “e” stop grub to load because pressing “e” indicated edit mode.
  • Press “e” again and it will take you to the following screen,
  • Select a Kernel on above screen in available options, as I chose “ module /vmlinuz-2.6.18-194.e15xen ro root=dev/VolGroup00/LogVol100 rh>” and Press “e” from keyboard. 
  • One time Press SPACEBAR and type Single and Press Enter
                                Note:  Make sure for having Space before “single”
  • Press “b” to boot your computer in single mode.
  • Now let your system boot in “Single Mode” and you will be finally on below screen. Type command, “passwd” and Press Enter as below screen.
  • You will be prompted for “New UNIX Password” Type your New Password and Press Enter,
  • You will be prompted for “Retype new UNIX password”, again your New Password to confirm, and Press Enter.
  •  Now, Type Power Off command and start your computer normally. Hope this will work for you, but it will not work on LILO boot loader. Let discuss further in comments.

Comments