Welcome to my site. Please CLICK HERE to give your opinions regarding this new look of "PCTipsbyAnu". Thanks for visiting.

Friday, December 17, 2010

Browse » Home » , , , , , » How to recover Linux root password?

How to recover Linux root password?



Hi friends, here is a way to recover your Linux (all distributions) password when you accediently forget it...
To get around a lost Linux root password:
You must have access to the console for this to work. Follow these steps:

  • Power off the system
  • Power on the system, wait for the LILO/SILO/MILO prompt (platform dependent)
(For more information about LILO/SILO/MILO : OR : More information about boot process of Linux as well as Windows : 
First :1: Second :2:

Depending on how lucky you are, or rather how ancient your linuxdistribution is, you might be able to get away with the following:

  • At the prompt, type <kernel> 1 (where <kernel> is the label you use to boot linux normally) and thus boot to single user mode.
  • In single user mode, linux never used to prompt for the superuser password. If this is the case with your system, simply use mount -o remount -n / and then use the passwd command to change the superuser password.
If you're blessed with a somewat more secure system, you need to do this:
  • At the prompt, type in <kernel> init=/bin/sh (where <kernel> is thelabel you use to boot linux normally).
  • Once the system dumps you at a "# " prompt, type: mount -o remount -n /
  • echo root2:x:0:0:::: >> /etc/passwd
  • echo root2:::::::: >> /etc/shadow
  • sync
  • Power cycle the system.
  • Once the system has booted, log in as root2 (you shouldn't be prompted for a password) and use the command passwd root to change the root pasword,then userdel to remove the root2 user.
  • Problem solved.
There are of course many variations on the linux version. For example, you could edit /etc/shadow directly. This requires knowledge of text editors such as ed (most of the time, you won't have a normal terminal when you boot like this and vi won't work!) which may or may not be an unreasonable expectation.

Thanks....
You can leave a response, or trackback from your own site.

About 'Anu': My name is 'Anu' also Known as 'ANU 007 TIGER' .I'm administrator of 'PC Tips by Anu' blog .This blog was opened for sharing contents about hacking n cracking.
Thanks YAHOO OR GMAIL

1 comments:

Anonymous said...

This tutorial don't work!

Post a Comment

 
Back to Top