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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-29-2007, 06:28 AM
|
#1
|
LQ Newbie
Registered: Oct 2007
Distribution: Debian 4.0 r0 (etch)
Posts: 4
Rep:
|
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
|
|
|
10-29-2007, 07:22 AM
|
#2
|
Member
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Rep:
|
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.
|
|
|
10-29-2007, 07:33 AM
|
#3
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
|
|
10-29-2007, 07:37 AM
|
#4
|
LQ Newbie
Registered: Oct 2007
Distribution: Debian 4.0 r0 (etch)
Posts: 4
Original Poster
Rep:
|
Hey
When i type "su -" it just says sorry and goes back to the user prompt
|
|
|
10-29-2007, 08:08 AM
|
#5
|
Member
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257
Rep:
|
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.
|
|
|
10-29-2007, 08:19 AM
|
#6
|
LQ Newbie
Registered: Oct 2007
Distribution: Debian 4.0 r0 (etch)
Posts: 4
Original Poster
Rep:
|
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
|
|
|
10-29-2007, 09:28 AM
|
#7
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
|
|
10-29-2007, 09:45 AM
|
#8
|
LQ Newbie
Registered: Sep 2007
Distribution: Knoppix/Ubuntu
Posts: 16
Rep:
|
I wish I would have seen this earlier. I was locked out of a fresh install of ubuntu so I just reinstalled it. lol.
|
|
|
10-29-2007, 09:46 AM
|
#9
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797
|
Quote:
Originally Posted by PTrenholme
... (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)
|
|
|
10-29-2007, 04:36 PM
|
#10
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
|
|
10-29-2007, 11:07 PM
|
#11
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797
|
You can indeed unlock by running sudo passwd root.
|
|
|
All times are GMT -5. The time now is 11:37 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|