root password recovery fedora core
- Angelo Schalley
- Oct, 04, 2009
- Linux
- No Comments
Option 1:
1) Reboot (CTR-ALT-DEL) and at the lilo prompt type # linux single*
2) The kernel will load up and you will be straight into a root shell.
3) Now type passwd root to set the new password and reboot to resume operations.
* This assumes you have a kernel called ‘linux’ – you can hit tab at the lilo prompt to see the name of your Kernel.
Option 2:
You basically have to gain access to your machine somehow to alter the respective files. A pretty convenient way is to use the bootable installation CDs of some Linux distro and launch some “recovery console”. If you can’t see some comand like that you might try the ALT+F1..Fx keystroke to maybe get a clear console. Once you have managed to get into a shell you need to mount the partition that holds your /etc directory.
1) Open the file /etc/passwd and look for a line starting with … root:x:………
2) Delete the “x” in this line as it tells that the password is shadowed.
3) Save the file.
4) Open /etc/shadow and search for the entry for “root”. Usually looks like this … root:$s0m3fR1g9InMD5h45H::::::
5) Delete all values (the stuff between the columns) so that you get a line like this … Root::::::::
6) Save the file, unmount the partitions and reboot. The root-account should not have set a password now, which you should change immediately again.
Fedora Core 2 (FC2)
Fedora Core 3 (FC3)
Fedora Core 4 (FC4)
Using the grub boot loader
You can do the following:
1) Reboot the machine and hit any key when you see Grub kicking in. This will be after the BIOS checks but before any services start up.
2) You will now see a list of various kernels you can boot into, the first one in the list will probably be highlighted, and the default. It may be something like (for Fedora Core 4 multi-processor):
Fedora Core (2.6.11-1.1369_FC4smp)
3) Press “e” to edit the boot up arguments
4) These will look something like:
root (hd0,0)
kernel /vmlinuz-2.6.11-1.1369_FC4smp ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.11-1.1369_FC4smp.img
5) Press the down arrow and then “e” to edit the kernel line, put a space and “1” at the end
kernel /vmlinuz-2.6.11-1.1369_FC4smp ro root=LABEL=/1 rhgb quiet 1
6) Hit enter and then type “b” to boot the kernel, the kernel will now boot to run level 1, rather than 3 or 5 which it will probably set to by default. It will only boot to run level 1 this time, and will then revert to 3 or 5.
7) After some basic services have started you should get a command prompt. Run the command passwd, and enter your new password. Now type reboot.
Commonly, run levels are used in the following way:
0 – Halt
1 – Single-user mode
2 – Not used (user-definable)
3 – Full multi-user mode (no GUI interface)
4 – Not used (user-definable)
5 – Full multiuser mode (with GUI interface)
6 – Reboot