reset your centos root password +

I recently had to deal with a CentOS machine that needed to have the root password changed. When I got to the Grub menu, nothing worked, in order to enable the Edit menu. Changing the keyboard solved the issue, it looks like the p key was broken, heh.

Anyways, this is the procedure to quickly change the root password on a CentOS 5.4 64 bits machine:

1. Restart your box and when you see the Grub boot page, press any key to display the list of kernels. Highlight the kernel you want to load, press the p key to enter the Grub password, then press the e key to enter the Edit mode.

2. Once in Edit mode, select the second text line that starts with kernel, press again the e key to edit the selected kernel line and append the S capital character at the end:
/kernel /vmlinuz-2.6.18-164.15.1.el5 ro root=/dev/md2 rhgb quiet S

3. Press Enter, then press b key to boot in single mode. The system will boot in text mode and welcome you with the standard prompt:
sh-3.2# _

4. You will need to mount the / partition in write mode:
sh-3.2# mount -o remount,rw /

5. Now, you can change the root password:
sh-3.2# passwd
Changing password for user root.
all authentication tokens updated successfully

6. Once the password changed, reboot:
sh-3.2# sync
sh-3.2# reboot

Related Entries

Leave a Reply