PDA

View Full Version : Recovering your ROOT Password



SharedMedia
16th November 2004, 11:12 PM
Security HowTO for a forgetful Admin.
WARNING: Mechanic is NOT Licensed, use Manual with CAUTION!

Ever FORGET the ROOT Password? Need to recover?.. :rolleyes:

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:<numbers>:<more numbers>::::
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.

ilja
17th November 2004, 12:15 PM
For GRUB:
e to edit,
then e to edit the line.
Then enter to save and b to boot.

deuch
17th November 2004, 01:54 PM
you have just to boot in single mode and change the root password ??? abd after this tips you will have the root privileges ??? it's a little unsecure, no ?????

deuch

ilja
17th November 2004, 01:55 PM
no it isn't. In a computer where you are afraid of an physical access, you'll have a encrypted-root partition and at least grub and bios password, not to let the people boot from a CD.

peterwalsham
26th September 2005, 11:54 AM
To change the root password if you've forgotten it, with systems such as:

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

Jman
28th September 2005, 11:04 PM
Resetting root password is also explained in the Fedora Basics FAQ (http://www.fedorafaq.org/basics/#resetroot).

soongwoo
2nd October 2005, 11:33 PM
I have detailed the situation:
- no boot loader
- no root password, but one user account with its password

I can not
- change run level by editing /etc/inittab, since it can only be rewritten by root.
- add additional boot option, since no boot loader is installed.

Is there a way to set root password with FC3 x86_64 disc one CD?

thanks in advance
soongwoo

maddy2405
30th September 2008, 04:04 PM
Hey Peter,

This worked like a charm, tanx a ton!


To change the root password if you've forgotten it, with systems such as:

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