LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-08-2007, 07:54 PM   #1
JSR_tuxbox
LQ Newbie
 
Registered: Jun 2007
Distribution: debian etch
Posts: 26

Rep: Reputation: 15
Recovering root password in debian with grub bootloader


Hi, all!

I'm trying to recover the root password for a linux installation that I did about three months ago. Lost the slip of paper... anyway, I've found a couple of solutions online involving editing the line containing "kernel" in the grub loader. The first one suggested adding "single" to the end of that line; but when I did that, the system prompted me for the root password so that I could perform maintenance. Doh!

The second solution I found was to add "init=/bin/sh" to the end of the same "kernel" line. I did this, and it seemed to drop me into a shell. The next step was to "mount -orw,remount /". I did this, then typed "passwd", at which point I was informed that the shell did not recognize the command "passwd". This is when I realized I was out of my league. I typed "exec init," signed online, and made this post. If anyone could help me with this, I'd really appreciate it.

Incidentally, am I at risk because I forgot to "mount -oro,remount /" before "exec init"? Is all my system open for writing now?

Thanks in advance for any help!
 
Old 12-08-2007, 07:58 PM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
maybe try /usr/bin/passwd or wherever the command is located...
 
Old 12-08-2007, 09:02 PM   #3
JSR_tuxbox
LQ Newbie
 
Registered: Jun 2007
Distribution: debian etch
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks! I looked up the passwd command through google, and found that it is indeed supposed to be located in /usr/bin. Unfortunately, the shell tells me that that directory doesn't even exist! I swear, this is a functional installation -- I'm using it to submit these posts and everything. Does anyone have any more ideas? Is it possible that there's no /usr/bin because I'm "logged in" as root when I init the system in this way?
 
Old 12-09-2007, 12:17 AM   #4
Walker2
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
When your boot screen appears, press an up arrow key to suspend it. You'll notice a line near to bottom of the screen that contains the word "Boot options". You can now type a command on that line so type,
init=/bin/sh
press enter and when the text stops scrolling you should be presented with a blinking cursor. You then type
passwd
Press enter and you will then be prompted for a new root password. Type it in and press enter. You'll be asked to reenter it. Do so and press enter again. After you've done that -ctrl-alt-del restarts the computer.
Hope this works on your system. I've only used it on SUSE 10.3.
Good luck !
 
Old 12-09-2007, 12:23 AM   #5
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 69
See if you can edit the /etc/shadow file then on the line that starts with root: delete everything between the : after root to the next : then save the file that part is the password next time you boot the root password would be blank so you can set a new one alternatively boot with a live CD like Knoppix mount your / partition read/write then edit the shadow file that way.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recovering root password in Redhat linux nthillaiarasu Linux - General 2 11-21-2007 08:11 AM
recovering root password gentoo lilo farhan Linux - Security 1 03-22-2006 09:57 PM
LXer: Howto: Recovering grub boot loader password LXer Syndicated Linux News 0 02-22-2006 05:16 AM
recovering root password isaacvimal Red Hat 3 04-02-2005 09:47 AM
recovering root password in rh using lilo farhan Linux - General 1 03-01-2003 09:45 PM


All times are GMT -5. The time now is 09:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration