LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-29-2007, 06:28 AM   #1
tomthebomb3
LQ Newbie
 
Registered: Oct 2007
Distribution: Debian 4.0 r0 (etch)
Posts: 4

Rep: Reputation: 0
Red face Forgot root passwd!! :-(


Hey

I'm new to linux and have downloaded debian, as it was recommended to me.

I have forgotten my root password!!! I have tried to get in to single user mode but that still requires a passwd. I googled my prob and found this page http://www.debianhelp.co.uk/root.htm

I have tried both solutions but to no avail.

Has anyone got any ideas??

Thanks in advance

Tom
 
Old 10-29-2007, 07:22 AM   #2
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Hmm.. single user mode shouldn't ask for a password. Anyway, as an alternative: If you have a live cd nearby, boot in with it, mount and chroot into your harddisk's root partition and change the password. i.e, once you've logged in with the live cd, open a terminal and type:
Code:
mkdir /tmp/scrap
mount /dev/hda1 /tmp/scrap (replace hda1 with sda1 or with wherever your / partition is installed)
chroot /tmp/scrap
passwd
After your done, type exit and umount /tmp/scrap and reboot normally without the live cd.
I've not tried this, I usually use chroot just to make lilo changes, so someone please correct me if this won't work.
 
Old 10-29-2007, 07:33 AM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Can you use the sudo command? (That one asks for your password to run a command as root.) If you can, you can do a sudo passwd root to reset the "root" password. (I just installed Kubuntu 7.10 on one of my computers, and it was easier to do that than to search for whatever default root password was used by the installer -- which doesn't ask for a root password. I mention this since Ubuntu is Debian based, and sudo was automatically set up by the install, and so I thought it might also be done in a real Debian installation.)

As to the instructions you referenced, they should have worked if you followed them exactly. Any "Linux Rescue CD" should enable you to reset the root password following those instructions.
 
Old 10-29-2007, 07:37 AM   #4
tomthebomb3
LQ Newbie
 
Registered: Oct 2007
Distribution: Debian 4.0 r0 (etch)
Posts: 4

Original Poster
Rep: Reputation: 0
Hey

When i type "su -" it just says sorry and goes back to the user prompt
 
Old 10-29-2007, 08:08 AM   #5
dickgregory
Member
 
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
Notice that there is a difference between su - and sudo. su will ask for the root password and continue to behave as root until you exit. sudo asks for YOUR password and acts as root just for one command.
 
Old 10-29-2007, 08:19 AM   #6
tomthebomb3
LQ Newbie
 
Registered: Oct 2007
Distribution: Debian 4.0 r0 (etch)
Posts: 4

Original Poster
Rep: Reputation: 0
i get this

tom@TOMSTESTBOX:~$ sudo
sudo: no passwd entry for root!

shall i go back and add a password into the /shadow or /passwd files?

Tom
 
Old 10-29-2007, 09:28 AM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Are you sure that you typed only sudo? If you did that, you should have gotten the usage instructions:
Code:
$ sudo
usage: sudo -K | -L | -V | -h | -k | -l | -v
usage: sudo [-HPSb] [-p prompt] [-u username|#uid]
            { -e file [...] | -i | -s | <command> }
Did you try the command exactly as I typed it in my prior post: sudo passwd root ? You should have seen something like this:
Code:
$ sudo passwd root
Password:
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
(Note that the response to the first "Password:" prompt is your password.)
Also, the response you noted suggests that the root password has, in fact, been deleted. Try booting in single-user mode again -- you may not now need a password.
 
Old 10-29-2007, 09:45 AM   #8
Flash19
LQ Newbie
 
Registered: Sep 2007
Distribution: Knoppix/Ubuntu
Posts: 16

Rep: Reputation: 0
I wish I would have seen this earlier. I was locked out of a fresh install of ubuntu so I just reinstalled it. lol.
 
Old 10-29-2007, 09:46 AM   #9
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by PTrenholme View Post
... (I just installed Kubuntu 7.10 on one of my computers, and it was easier to do that than to search for whatever default root password was used by the installer ...
A bit off topic:
You will search forever as the root account is locked (see man passwd, -l option)
 
Old 10-29-2007, 04:36 PM   #10
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by Wim Sturkenboom
You will search forever as the root account is locked (see man passwd, -l option)
Strange. I believe that I can now log in a root with no problem on Kubuntu. I guess the password was unlocked by my usage of the passwd command, eh?

Edit: OK, now I'm on the Kubuntu 7.10 distribution, and su - worked just fine (using the password I'd entered.) So it seems that my use of sudo to set the password undid any lock that was set.

Last edited by PTrenholme; 10-29-2007 at 04:57 PM.
 
Old 10-29-2007, 11:07 PM   #11
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797

Rep: Reputation: 282Reputation: 282Reputation: 282
You can indeed unlock by running sudo passwd root.
 
  


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
Forgot my root passwd k1ll3r_x SUSE / openSUSE 23 04-06-2005 12:44 PM
forgot root passwd urgent nimaelec1 Red Hat 4 02-17-2005 11:37 AM
forgot root passwd sanu Linux - Newbie 2 09-21-2004 02:07 AM
forgot root passwd sanu Linux - Newbie 1 09-20-2004 04:45 AM
FORGOT root passwd WannaLearnLinux Linux - Newbie 5 03-30-2004 12:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:37 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
Open Source Consulting | Domain Registration