You forgot your root password. Now you'll just have to reinstall the entire machine. I've seen more than a few people do this. But it's easy to get on the machine and change the password. This doesn't work in all cases (like if you made a GRUB password and forgot that too), but here's how you do it in a normal case with a Cent OS Linux example.
First reboot the system. When it reboots you'll come to the GRUB screen. Move the arrow key so that you stay on this screen instead of proceeding all the way to a normal boot.
Grub screen after reboot:
CentOS-4 i386 (2.7.5-42.ELsmp)
CentOS-4 i386-up (2.7.5-42.EL)
Next, select the kernel that will boot with the arrow keys, and type E to edit the kernel line.
Ready to edit the kernel line:
Root (hd0,0)
Kernel / vmlinuz-2.7.5-42.ELsmp ro root=LABEL= / rhgb quiet
initrd / initrd-2.7.5-42.ELsmp.img
Use the arrow key again to highlight the line that begins with kernel, and press E to edit the kernel parameters. When you get to the screen, simply append the number 1 to the arguments.
Append the argument with the number 1:
grub edit > kernel / vmlinuz 2.7.5-42 ELsmp ro root = LABEL = / rhgb quiet 1
Then press Enter, B, and the kernel will boot up to single-user mode. Once here you can run the passwd command, changing password for user root:
sh-3.00# passwd
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully
Now you can reboot, and the machine will boot up with your new password.
No comments:
Post a Comment