recover my root password

is there any way to recover my root password in case i get lock out, ot forgot the root password???...




Topic Options
#144413 - 08/26/04 07:18 AM recover my root password
jarves Offline
member

Registered: 12/23/03
Posts: 154
is there any way to recover my root password in case i get lock out, ot forgot the root password???

Top
Advertisement
#144420 - 08/26/04 09:38 AM Re: recover my root password
blackpage Offline
member

Registered: 03/23/04
Posts: 120
gidday jarves

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. To reset the root password open the file /etc/passwd and look for a line starting with ...

root:x:.........

Delete the "x" in this line as it tells that the password is shadowed. Save the file.

Secondly open /etc/shadow and search for the entry for the user "root". This one usually looks like this ...

root:$s0m3fR1g9InMD5h45H:<numbers>:<more numbers>::::

Delete all values (the stuff between the columns) so that you get a line like this ...

root::::::::

Save the file, unmount the partitions and reboot. The root-account should not have set a password now, which you should change immediately again.

hope that helps

Top
#144433 - 08/26/04 03:51 PM Re: recover my root password
Dapper Dan Offline
Pooh-Bah

Registered: 09/27/03
Posts: 1703
Loc: The Sovereign state of South C...
Excellent instructions blackpage! I had to do this on my brother in law's laptop just a few weeks ago. What you wrote here is exactly what I did to the letter! smile

Top
#144436 - 08/26/04 05:53 PM Re: recover my root password
blackpage Offline
member

Registered: 03/23/04
Posts: 120
Thanx DapperDan for the kind words. To be honest: A couple of months ago I did a lot of test-installs and with most of them I fooled around with the accounts as I never planned to use the setup "for real"; til one day when I had to do some tricky postgres-stored-procedure fun on a production machine. I knew I had already done that on one of the test machines, alas, I didn't recall the root-password smile

So a little search on the net made me dig up the above procedure. Quite slick and precise. My thanx therefore goes out to the unknown author of this, from whom I shamelessly leeched the knowledge smile

Top
#144458 - 08/27/04 12:59 AM Re: recover my root password
martouf Offline
enthusiast

Registered: 07/09/04
Posts: 338
TIMTOWTDI - there is more than one way to do it

here's another way for when you know the system is still OK but you didn't arrive
with boot/rescue disc in hand:

1. boot with parameter "init=/bin/bash"

2. the disks will be mounted read-only (ready for fsck), so remount the ones
you need to write to as read-write.
( for me, it's: "mount -o remount,rw /dev/sda2 /" )

3. change any account pwd you want: "passwd root" or "passwd user12"

4. "sync" ( for purists, it's: "sync;sync;sync" )

5. CTRL-ALT-DEL

done! 8)

Top


Forums
Windows Support Forums
Everything New Technology
Legacy OS
Hardware
Software
Games
Networking
Customization & Tweaking
Security

Linux Support Forums
Everything Linux
Linux Hardware
Linux Software
Linux Games
Linux Networking
Linux Customization & Tweaking
Linux Security

Apple Support Forums
Everything Apple
Recent Topics
WRT54G v.3 router problem HELP!
by Neerolyte
Yesterday at 03:43 AM
Ra2 please help
by nayona
10/11/08 10:33 PM
older games
by allanonbohe
10/11/08 06:01 PM
media player version 9
by TerryR
10/11/08 11:08 AM
need advice about backup my PC
by fpin
10/08/08 06:19 PM
Who's Online
1 Registered (danleff), 171 Guests and 10 Spiders online.
Key: Admin, Global Mod, Mod
Forum Stats
89257 Members
24 Forums
40911 Topics
170579 Posts

Max Online: 1079 @ 03/12/08 01:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22