Distroname and release: CentOS
Reset root password
OK, so you have lost your password to your computer, or one of your clients in the network, and you need to reset the root password? Then please continue reading, it is a very simple task, at least if you are running GRUB.The boot process
When GRUB starts, press [e], to your currently used kernel to edit the boot parameter.Now in the line starting with "kernel" add the word "single" to the end of the line. In some cases, it is needed to add "single init=/bin/bash".
The process differs a little from GRUB to GRUB2.
In GRUB press [e] to edit the line, and then press [enter] when done. Press [b] to boot with the changes.
In GRUB2 press [e] to edit the line, and then press [CTRL]+[X] to boot after the changes.
Example of the GRUB line after the change:
kernel /vmlinux-2.6.18-164.15.1.e15 ro root=/dev/VolGroup00/LogVol00 singleIf you are prompted for a CTRL-D input to continue, you will need to add the init=/bin/bash as well.
kernel /vmlinux-2.6.18-164.15.1.e15 ro root=/dev/VolGroup00/LogVol00 single init=/bin/bashIf you have done it the correct way it should boot directly to the shell as root, without the need of typing any password. Now remount the system, so you have write access.This is not always this is needed, but if you have problems when setting a new password, please do it.
#mount -o remount,rw /Now it is time to create a new password, simply execute the following command.
#passwdFinally make sure that the changes are written to the harddisk before we reboot.
#sync #init 6Now let it boot up completely, and you should be ready to go with the new password.