Link to home
Start Free TrialLog in
Avatar of sairaseven
sairaseven

asked on

root password

I have forgotton the password of the root of my Linus.  But i can login as a simple user ..........

I have to mount the harddisk and do other administrative works ......................
Please give me some way to get or change the root password..
Avatar of S0lar
S0lar

do u have physical access to server?
S0lar ask you a good question, can you physically access the linux box? if yes, and if it's using lilo as boot manager you can try below

At lilo-prompt send the parameter single or 1 to lilo to boot in singel-user-mode.

1. type linux single or linux 1 at the lilo-prompt

2. type passwd root

3. enter a new password

4. type init 3 to continue to runlevel 3 (or init 5 if you use xdm)

You can also use a boot-root disk and mount the /etc partition and blank out the password in /etc/shadow
paullamhkg gave you correct procedure for lilo.
And here is procedure for linux box with grub as boot loader:
-------------
At the bootloader menu, type [e] to enter into editing mode.

You will be presented with a boot entry listing. Look for the line that looks similar to the following:

kernel /vmlinuz-2.4.18-0.4 ro root=/dev/hda2


Press the arrow key until this line is highlighted and press [e].

You can now add the word single once space after the end of the text to tell GRUB to boot into single-user Linux mode. Press [Enter] to make the editing change take effect.

You will be brought back to the edit mode screen. From here, press [b] and GRUB will boot single-user Linux mode. After it finishes loading, you will be presented with a shell prompt similar to the following:

sh-2.05#


You can now change the root password by typing

bash# passwd root


You will be asked to re-type the password for verification. Once you are finished, the password will be changed. You can then reboot by typing reboot at the prompt; then you can log in to root as you normally would.
you can download tomsrootboot   http://www.toms.net/rb/

boot computer from floppy

type "fdisk -l" to get current partition information

mount the partition containing the /etc/shadow files
  ex.  "mount /dev/hdc5 /mnt"

vi shadow you will find an entry as below

root:$1$ve.2WRaU$F8FZqVNwcgQftsnWCG5Ig0:12202:0:99999:7:::

change it to

root::12202:0:99999:7:::

save the file, now your root is no password, boot up your linux, login as root without password need, and add the new password for your root

passwd root

hope this info can help :)
ASKER CERTIFIED SOLUTION
Avatar of ngopu
ngopu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ngopu: before posting comments, please read other experts' posts. Don't duplicate someone's solutions, propose something new only...
You can log in using single-user mode and create a new root password.
To enter single-user mode, reboot your computer. If you use the default bootloader, GRUB, you can
enter single user mode by performing the following:
1. At the bootloader menu, type [e] to enter into editing mode.

2. You will be presented with a boot entry listing. Look for the line that looks similar to the following:
kernel /vmlinuz-2.4.18-0.4 ro root=/dev/hda2
Press the arrow key until this line is highlighted and press [e].

3. You can now add the word single once space after the end of the text to tell GRUB to boot into single-user Linux mode. Press [Enter] to make the editing change take effect.

4. You will be brought back to the edit mode screen. From here, press [b] and GRUB will boot single-user Linux mode. After it finishes loading, you will be presented with a shell prompt similar to the following:
sh-2.05#

5. You can now change the root password by typing
bash# passwd root

You will be asked to re-type the password for verification. Once you are finished, the password will be changed. You can then reboot by typing reboot at the prompt; then you can log in to root as you normally would.
Hope this helps

Regards
:-)
S0lar, is someone try to expend your comment more detail? LOL ;)