Login (generic cert)
Logout
Guests 21
If you can walk and chew gum at the same time, you can run GNU/Linux
Blog Pushes

debian tutorials
debiantutorials.org is built on and runs on Debian.

 

Creative Commons License
Reset your root Password on your Debian Machine Print E-mail
Written by machiner   
Tuesday, 04 March 2008 16:33
If you have physical access to a Linux box there is all kinds of havoc you can wreak. Knowing the root password isn't necessary because there are a couple ways that you can change it. Keep tabs on your root password.

Sometimes stuff happens. Sometimes you set Debian up on your buddy's machine and you're both too drunk to remember what you did the next day. Root password!? OMFG! No, it's never happened to me, but I can believe it does happen.

On your Debian box, and probably most other Linux distributions, a way to reset the root password is to reboot into single-user-mode. Some distros call it a recovery mode. It's not enough to simply select single-user-mode when you boot because you will still be prompted for the root password. What you have to do is edit your kernel line. Wicked easy.

When Grub shows you your kernel boot options, hit the letter e to enable editing. Once you're actually in edit mode, arrow down to the kernel line and hit e again. What you need to do is add the following to the end of the line:

init=/bin/bash

So, your kernel option entry might red something like this:

/vmlinuz-2.6.18-5-486 root=/dev/hda2 ro vga=791 init=/bin/bash

Hit enter after you've appended the entry, and then the letter b to boot that kernel. In a moment you will be entered into a limited bash shell so you can run the passwd command to reset your root password. You will not be able to run many other commands. For example: # shutdown -r now will not work. However, # halt will, so you can shut the box down after you've reset the root password with that. It'll shut down your hard drives but you'll probably have to power down the machine yourself.

Restart your machine and then boot normally. Once up, fire up a terminal and check to see if you can't become root.

There ya go. Yo have successfully reset the root password on your Debian GNU/Linux machine. It's creepy posting something like this but I have received many inquiries as to how it's done by some desperate sounding folks.

--machiner 4 mar 08 all creeped out

discuss

Comments
Add New
+/-
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly:
:dry::lol::kiss::D:pinch::(:shock:
:X:side::):P:unsure::woohoo::huh:
:whistle:;):s:!::?::idea::arrow:
 
creepy guy  - Mu hahahahahahahaaaa   |64.30.72.xxx |2008-03-06 10:15:03
Muu haa hahahahahahahahahaa hahahahahah hahahahahahahaaaa
guest  - You got locked out, mwahahahaha!   |88.11.103.xxx |2008-03-13 01:59:21
"I don't like telling you all how to do something like this but I have received many inquiries as to how
it's done by some desperate sounding folks."

You mean you got locked out of your own box, and you've
posted your two weeks of frantic research here so you don't lose it
machiner  - lol   |Publisher |2008-03-13 04:54:13
avatar Yeah....that's what I do for all the tutorials I write.

tool
dhalgren  - thanks   |121.223.247.xxx |2008-03-19 16:04:12
thanks machiner... just when I needed it.
petekorm  - thanks!   |69.70.142.xxx |2008-04-29 12:34:25
thanks buddy, happened to me, but when I tried it I got the '' Authentication token lock busy '' thingy..
tried with the -u option, and it said '' cannot unlock the password file; try again later '' .... hmmm, when
is later?

Im a newbie, please bare with me

thanks again
petekorm  - fixed!   |69.70.142.xxx |2008-04-29 12:41:10
ok if someone has the same problem as I did, when you edit your kernel line, change the RO to RW (read/write i
guess, but again its just a guess) so the final line should look like this :

/vmlinuz-2.6.18-5-486
root=/dev/hda2 rw vga=791 init=/bin/bash (instead of)
/vmlinuz-2.6.18-5-486 root=/dev/hda2 ro vga=791
init=/bin/bash
techspeed  - it went to kernel panic   |68.112.245.xxx |2009-12-12 03:36:40
not a good advise. The system went on to kernet panic: not syncing : Fatal exception in
Interrupt.

techspeed

EDITED: 12dec09, machiner:

PEBCAK
Kedar   |59.162.68.xxx |2008-09-18 01:26:30
Debian root password recovery if forgotten
1. Reboot machine and on the grub menu, edit the line for your
kernel and add the following at the end --
init=/bin/bash
2. Once at the root prompt, put the following
command --
mount -o remount,rw /
3. Use following command to change root password --
passwd root
4. Reboot
machine with "halt" or "ctrl alt del" keystrokes.
dguildford   |203.214.35.xxx |2009-07-10 11:55:55
My story
I installed Debian Lenny for PPC on iMac G3 400 DV Tangerine, upgraded to 192MB RAM, 80GB HD and iMac
v4.1.9 firmware update.
Boots fine (little coloured penguin at top of screen) to a black
screen.
Ctrl-Option-F1 gets the display going and I log in successfully, so User password is ok.
Try to get
X.org working with
Sudo requires root password which I enter but greeted with "sorry try again". I
set Root password differently from User password during setup.
Did a second complete install to eliminate the
possibility of an incorrect Root password entry with same result.
Saw your advice at
http://www.debiantutorials.org/reset-root-password -debian-gnulinux-etch-286
Questions:
Reboot into recovery
mode/Grub shows kernel boot options
The boot options I get are l (lowercase L) and c. At this point e is not
accepted.
I don't know why the Root password gets stored incorrectly, but would like to replace it and your
workaround looks just right. Your advice please.

dguildford
bassualdo  - none of this worked!!   |201.22.29.xxx |2009-08-25 07:20:54
i guess you guys didn´t understand the problem!!
the case is that we lost the root password and none of this
ptions explained by you worked on a debian distro! if someone have another option would be great. otherwise
you have to re-install the system!!
machiner  - This is to reset   |68.112.245.xxx |2009-08-25 09:09:04
And it works fine.
spado  - Authentication token lock busy   |82.227.219.xxx |2010-03-15 07:44:03
if you have erro msg :
passwd: Authentication token lock busy
passwd : password unchanged

type for remount
withe good right to write :

# mount -o remount,rw /
Erik  - reset all pwd   |75.138.188.xxx |2011-05-03 15:14:34
Hi,

The problem I\'m having is that we don\'t know any of the passwords. Will rebooting the system
bring me up to change parameters, or will I have to know at least a pwd?

Thanks in
advance.

Erik


EDIT: - No. You will be changing the password with this method.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Wednesday, 30 April 2008 17:36