LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 02-22-2005, 01:00 PM   #1
kapslock
LQ Newbie
 
Registered: Aug 2003
Posts: 28

Rep: Reputation: 15
reset root password


I have a debian box with important application running on it ,i don't know what the root password is ,the guy who knew has left and did not bother to pass on information.I have heard theres a program one can run ..just pop in a cd and follwo instruction to reset the root password.
thanks
 
Old 02-22-2005, 01:15 PM   #2
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
try booting to runlevel 1 and changing the password there...
 
Old 02-22-2005, 01:15 PM   #3
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
Quote:
.just pop in a cd and follwo instruction to reset the root password.
Yes, sort of. The "program" is named Knoppix. Get yourself a CD with it, "pop it in" then do:
-open up a Terminal (it's on the down-left side of the screen, on the taskbar, an image shaped as a black monitor)
-type 'su' - without quotes
Here's the most "difficult" part. You must know which harddrive (and which partition) holds your Debian install. I'll assume it's hda1 (might be as well hdb3, hda2, etc.)
-type 'mount -t ext3 /dev/hda1 /mnt/hda1'
-type 'chroot /mnt/hda1 /bin/bash'
-type 'passwd root'
-type in twice the new password
-type 'exit' twice
-reboot.
 
Old 02-22-2005, 01:26 PM   #4
sh1ft
Member
 
Registered: Feb 2004
Location: Ottawa, Ontario, Can
Distribution: Slackware, ubuntu
Posts: 391

Rep: Reputation: 31
at the lilo prompt you could also add the parameter init=/bin/sh and that will give you a root shell upon boot.
 
Old 03-03-2005, 08:13 PM   #5
wael_nasreddine
Member
 
Registered: Jun 2004
Location: France
Distribution: debian sarge
Posts: 109

Rep: Reputation: 15
Quote:
Originally posted by sh1ft
at the lilo prompt you could also add the parameter init=/bin/sh and that will give you a root shell upon boot.
exactly!!! and on grub? this don't work??
 
Old 03-04-2005, 05:13 PM   #6
mda127
LQ Newbie
 
Registered: Mar 2005
Location: State College, PA
Distribution: fedora core 3, ubuntu
Posts: 5

Rep: Reputation: 0
Resetting the root password.

LEGEND:
Commands are set in red.
Display views are set in green.

I had to do this on Ubuntu today and here is what I did:

- Restart you computer and wait for GRUB. You may have to press the 'esc' to pick from a list of kernels. When you get to the list pick one and type 'e' to edit it. Another list will show up. Scroll down and pick from the list something that looks like this (or something similar):

kernel /vmlinuz-x.x.x-x.x ro root=/dev/blah/

Type 'e' again to edit this line. Make sure that you press the space bar and add the following:

init=/bin/bash

Then press enter. The line should look something like this then:

kernel /vmlinuz-x.x.x-x.x ro root=/dev/blah/ init=/bin/bash

Press 'b' to boot. This will take you into a bash terminal. From there you'll have to mount your hard drive and allow for read/write pernissions. First you have to see the name of the mount. This is done by typing this command:

# mount

It should come up with something like:

/dev/hda1 (rw)

It looks like it's already set for read/write permissions, but it's not (just try and reset the password with the passwd command and see what happens). To mount it again type the following command:

# mount -o remount,rw /dev/hda1 /

Now you should be able to change the root password by issuing the following command:

# passwd

Type in the new password two times and the authentication tokens will be updated. Then restart the computer by typing the 'reboot' command. That's it. Hopefully this works for everyone. I have successfully done this with Ubuntu, Red Hat 8,9, and all of the Fedora Core distributions.
 
Old 03-04-2005, 05:16 PM   #7
mda127
LQ Newbie
 
Registered: Mar 2005
Location: State College, PA
Distribution: fedora core 3, ubuntu
Posts: 5

Rep: Reputation: 0
Resetting the root password.

This will not work if there is a GRUB boot loader password installed.

Last edited by mda127; 03-04-2005 at 05:18 PM.
 
Old 03-04-2005, 05:16 PM   #8
wael_nasreddine
Member
 
Registered: Jun 2004
Location: France
Distribution: debian sarge
Posts: 109

Rep: Reputation: 15
instead of going into /bin/bash and mount the system, you could go with INIT=/bin/sh and you can then change the passwd directly using paswd
 
Old 03-05-2005, 02:47 PM   #9
mda127
LQ Newbie
 
Registered: Mar 2005
Location: State College, PA
Distribution: fedora core 3, ubuntu
Posts: 5

Rep: Reputation: 0
Yep, did that too. Still had to make to mount the hard drive and make it read/write.
 
Old 03-05-2005, 05:06 PM   #10
mda127
LQ Newbie
 
Registered: Mar 2005
Location: State College, PA
Distribution: fedora core 3, ubuntu
Posts: 5

Rep: Reputation: 0
Yep, did that too. Still had to make to mount the hard drive and make it read/write.
 
Old 03-05-2005, 07:32 PM   #11
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
If editting grub commands...couldn't we just put a "1" in the place of the "init=/bin/bash" ?

I think that would drop us straight into a root shell.
 
Old 03-05-2005, 09:19 PM   #12
wael_nasreddine
Member
 
Registered: Jun 2004
Location: France
Distribution: debian sarge
Posts: 109

Rep: Reputation: 15
no it asks you for password
redhat based distro can be cracked like this, (that's how i did it at the university :P
 
Old 03-07-2005, 01:46 PM   #13
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
Really?

Is is a login prompt or just a boot password?

I'm just curious.
 
Old 03-07-2005, 01:48 PM   #14
wael_nasreddine
Member
 
Registered: Jun 2004
Location: France
Distribution: debian sarge
Posts: 109

Rep: Reputation: 15
a password
 
Old 07-27-2006, 07:08 AM   #15
rdvrey
LQ Newbie
 
Registered: Jul 2006
Posts: 1

Rep: Reputation: 0
For any form (that I know) of Unix/Linux:
- start a Unix/Linux OS from floppy or cd (Gentoo has a fine minimal install cd with editor)
- mount the partition with the /etc directory
- edit either the password or the shadow file
- in case of the shadow file remove all data (looks like garbage) between the first and the second semicolon
- you now have an empty password!

that is why any fysical access to any Unix/Linux Computer/server must be restricted!

It is of coarse important to make a backup of any systemfile before you alter it eg:
cp shadow shadow.bck


Robert

Last edited by rdvrey; 07-27-2006 at 07:15 AM.
 
  


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
Reset Root password hbenway AIX 9 08-19-2008 04:13 PM
How to protect Root password so it cannot be reset PAB Linux - Security 14 04-05-2005 07:05 AM
Preventing root password reset J.W. Linux - Security 2 04-07-2004 03:04 AM
how do i stop root password reset? robhargreaves Linux - Security 3 01-31-2004 09:16 AM
Reset Root password sdsouza Linux - Software 5 11-12-2003 04:50 PM


All times are GMT -5. The time now is 12:01 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration