LOST ROOT PASSWORD
Here is part two. Yesterday we had forgotten our user password and
disaster strikes again today we forgot the root password.
First, disconnect your PC from the net, pull the cable out !
Step 1: For Redhat and Mandrake:
Then boot from your first install CD and as the very first screen comes
up hit F2 and type:
rescue ( For RedHat "linux rescue" )
and the computer will boot in rescue mode.
It will show a few alternatives, select : ¨mount the existing
partitions¨ and go to the shell/console prompt.
( Booting Mandrake in "failsafe" from the Lilo menu does the same )
Step 1: For SUSE:
from your first install CD and press F1 at the first screen, then
choose "Rescue System" from the menu and at the prompt type "root" (
you do not need a password )
Step 1: For other distro's
Boot from the first install CD ( or any Live CD like Knoppix ) and at
the bootprompt type:
( For Knoppix: knoppix single )
And it will boot in "single user mode" and you will get an odd looking
prompt like “sh-2.05b#”
Alternative for step 1
with most Live and Rescue CDs you can also just boot in the live
version, mount the partition and, as root, make changes to the files
( if you boot from knoppix first cd to the partition your
lost-password-distro is on )
We need to change two files; ¨passwd¨ and ¨shadow¨:
( opens the file )
< i > ( puts vi in insertmode )
This is the first line:
So just get writ of the ¨x¨ do not touch the ¨:¨ (
Save the file:
Second file to be changed:
( open the file )
< i > ( insert mode )
The first line is a long scrambled line of characters, just make it:
root:::: ( four colons ! )
Save the file
Now you can reboot your computer. Log in as normal user, open a console
And set the new root password !
Log out as root:
And the job is done !!
Only after setting your new root password it is safe to connect your
computer to the internet or local network again !!
-- May 21 2003 ( Revised Dec 9 2005 ) --