LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-14-2007, 12:40 PM   #1
yosato_uk
LQ Newbie
 
Registered: Aug 2006
Location: London
Distribution: fedora, gentoo, openSuse
Posts: 13

Rep: Reputation: 0
password file lost... and disk inaccessible


Hi all,

I think I've done drastically stupid ... I have renamed the password file for some reason. The file itself is there with a different name, so it would only be renaming it back, but I can no longer access anywhere as anybody. Would anybody kindly tell me how I could access the root directory somehow?

Regards,
Yo
 
Old 01-14-2007, 01:37 PM   #2
FnordPerfect
Member
 
Registered: Dec 2006
Location: Germany
Distribution: Kubuntu (Feisty Fawn), Debian (SID)
Posts: 127

Rep: Reputation: 15
Don't panic.

* Don't you have a bootable CD with a Linux Live System? Then just mount your root partition and rename it back.

* Which Boot manager do you use? I hope it's grub or LILO. Both give you the ability to pass boot parameters to the kernel.

If you use GRUB, hit Escape to get to the boot menu, select the menu entry, hit e to edit the entry.

If you use LILO, I think you have to hold Ctrl before it loads the kernel...

One of those parameters is "init=" which tells the kernel the first program it should run after it has finished initializing. Normally this is a SysV style init programm, but actually it can be anything!
Just use "init=/bin/sh" and it will start a very basic Root shell, which should be sufficient to rename the file back.

Good luck

Last edited by FnordPerfect; 01-14-2007 at 01:41 PM.
 
Old 01-14-2007, 04:58 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The install CD should also allow you to get to a terminal---boot from CD and type ctr-alt-F1 when it finishes loading
 
Old 01-14-2007, 05:08 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by FnordPerfect
Just use "init=/bin/sh" and it will start a very basic Root shell, which should be sufficient to rename the file back.
And remember also, some distro's won't mount the / filesystem read-write when you pass init=/bin/sh or init=/bin/bash so in order to mount / which most likely has /etc, do the following:

mount /proc
mount -o remount,rw /

And then you should be able to edit your /etc/passwd file and or restore it, etc.
 
Old 01-15-2007, 07:17 AM   #5
yosato_uk
LQ Newbie
 
Registered: Aug 2006
Location: London
Distribution: fedora, gentoo, openSuse
Posts: 13

Original Poster
Rep: Reputation: 0
Hi FnordPerfect, thanks for your prompt help,

Quote:
Originally Posted by FnordPerfect
* Which Boot manager do you use? I hope it's grub or LILO. Both give you the ability to pass boot parameters to the kernel.

One of those parameters is "init=" which tells the kernel the first program it should run after it has finished initializing. Normally this is a SysV style init programm, but actually it can be anything!
Just use "init=/bin/sh" and it will start a very basic Root shell, which should be sufficient to rename the file back.
I tried this route: it worked eventually.

I simply put it at the end of kernel line:

kernel /boot/vmlinuz-x.x.x-x ro quiet splash init="/bin/sh"

this got me into the system, though I found it is /root directory (rather than /) which is my original /. Couldn't initially access the directory so tried changing ro to rw. Did work then.

Feel a bit wiser, you saved me, many thanx again.

Yo
 
Old 01-15-2007, 07:21 AM   #6
yosato_uk
LQ Newbie
 
Registered: Aug 2006
Location: London
Distribution: fedora, gentoo, openSuse
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by trickykid
And remember also, some distro's won't mount the / filesystem read-write when you pass init=/bin/sh or init=/bin/bash so in order to mount / which most likely has /etc, do the following:

mount /proc
mount -o remount,rw /

And then you should be able to edit your /etc/passwd file and or restore it, etc.
and of course I forgot to read this, othrewise I could have saved a lot of time... thanx trickykid!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lost dell laptop 5100 hard disk password student04 Linux - Newbie 1 05-01-2005 09:25 PM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 03:58 PM
Lost Password file when user deleted clickit999 Linux - Security 2 09-19-2004 11:12 AM
Terminus terminal; inaccessible file!?!?!?! Thermodynamic Linux - Software 0 08-01-2003 05:45 PM
inaccessible file names pikachu66 Linux - General 2 10-01-2001 12:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:16 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