LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 04-15-2014, 05:25 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
Root password lost.


Hi: I installed Debian etch and lost the password. I deleted the /etc/passwd file but that was no use. Can you tell me how I can login?
 
Old 04-15-2014, 05:37 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You've been here long enough to know how to first see the "Similar Threads" at the bottom of this page or seach LQ, right?
 
Old 04-15-2014, 05:45 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by stf92 View Post
I deleted the /etc/passwd file
I hope that you made a backup of that file, it contains information about all users (including system users) on your system.
 
Old 04-15-2014, 05:49 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by unSpawn View Post
You've been here long enough to know how to first see the "Similar Threads" at the bottom of this page or seach LQ, right?
That's what I did but it was of no help. Most of them refer to GUI related procedures.
 
Old 04-15-2014, 05:51 PM   #5
Archy1
Member
 
Registered: Jan 2014
Distribution: Debian
Posts: 95

Rep: Reputation: 2
I don't know if this will work on Etch but for Wheezy startup an install cd and enter rescue mode, then enter a shell in root, then "passwd".
 
Old 04-15-2014, 06:05 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Unfortunately the shell does not recognize the passwd command. I edited the /etc/shadow file and deleted the encoded information, though it consisted of o nly the exclamtion sign char (!) and it did not work.

I guess if I reinstall the package containing the passwd and shadow files I could then begin afresh.

Last edited by stf92; 04-15-2014 at 06:06 PM.
 
Old 04-15-2014, 07:18 PM   #7
b_mikhael
LQ Newbie
 
Registered: Apr 2014
Distribution: CentOS, Ubuntu
Posts: 8

Rep: Reputation: Disabled
Root password lost.

1- Reboot the system
2- In the GRUB menu before pressing enter on the kernel you want to boot, press letter "a".
3- At the end of the boot command options remove the word "quiet" then and number "1". the system will boot at runlevel 1.
4- Type "passwd root". you will be prompted to enter new root password without asking about the OLD root password.
 
Old 04-15-2014, 07:22 PM   #8
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
You are going to need to fire up a Live Session and chroot into your install to do anything in package management or even creating files in your install.

Once you have mounted the install on the Live Session you will be able to access the file system by opening the file manager as root.

Next time you want to experiment with system files don't remove the buggers. Simply rename them. /etc/passwd would become, as an example, /etc/passwd.def. The suffix you decide on can be anything you like. A lot of people like .bak. Windows users like .old. I like .def (default) for experimenting.

I would try, in the chroot environment simply running;
Code:
passwd root
Pretty sure you will have problems with this. The errors will point you in the direction you need to go.

In chroot you should have no trouble installing packages unless you have broken some link that affects dpkg.

Another thing you might want to try is;
Code:
dpkg configure base-passwd
or maybe it should be;
Code:
dpkg-reconfigure base-password
The idea is to get the install script for that package rerun to correct your "improvements".

A simple;
Code:
apt-get install --reinstall base-password
may do the trick.

Hopefully the system still will recognize your user. This seems a bigger concern to me than the password for root. root is, just like your user, a recognized user of the system. Problem is root is the only user that is common to all systems. Your user name is not.

You are, I am sure, going to have to run;
Code:
passwd <your user name>
if that runs it will be great. Problem is your group information may be gone too. May not be though. If not you should be fine. Check to see if /etc/group still exists. If so you should be alright once you get base-passwd to be reconfigured by the install script.
 
Old 04-16-2014, 11:11 PM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
I followed your directions, widget, but I must have done something wrong. Finally, I opted for a reinstallation. However, I now see the installer has an option for changing passwords. I had failed to see it. Thanks for your cooperation.
 
  


Reply



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
Lost root password Darlene Linux - Newbie 9 02-23-2010 03:27 PM
i lost my root password!!! raga4223688 Linux - Software 2 02-25-2007 01:32 AM
root password is lost!!! :( alaios Linux - General 3 11-07-2005 05:48 AM
lost root password thick_guy_9 Slackware 2 03-07-2005 08:35 AM
lost root password papitu76 Mandriva 12 10-31-2004 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:20 AM.

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