LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-04-2008, 04:31 PM   #1
skaynum
LQ Newbie
 
Registered: Dec 2006
Posts: 17

Rep: Reputation: 0
Root password recovery.


A friend of mine has forgotten his root password anyone with an idea on how to recover the password.I had tried to mount the filesystem with a bootable cd but could not view any of the files in the partition.
 
Old 11-04-2008, 04:38 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by skaynum View Post
A friend of mine has forgotten his root password anyone with an idea on how to recover the password.I had tried to mount the filesystem with a bootable cd but could not view any of the files in the partition.
You can't recover it.

You can set a new one. Just boot from a livecd, mount the relevant partition, cd into the mount point, chroot into it (chroot . should suffice) and then use passwd to set a new password.
 
Old 11-04-2008, 04:46 PM   #3
skaynum
LQ Newbie
 
Registered: Dec 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Root password recovery

Ok,ill try that and see if it works.
 
Old 11-07-2008, 03:50 AM   #4
skaynum
LQ Newbie
 
Registered: Dec 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Root Password recovery

I have been able to mount the /boot partition only and when i chroot into it it says /bin/bash could not be executed no such file or directory.I have tried to mount the other partition and it gives the error bad fs or bad block,what could be the problem?
 
Old 11-07-2008, 04:08 AM   #5
DT0X
LQ Newbie
 
Registered: Nov 2008
Location: South-West UK
Distribution: Fedora, RHEL 4 and 5, Ubuntu 7 and AIX
Posts: 12

Rep: Reputation: 0
What version of Linux is it?

You can recover it - might take some time though and is kinda pointless - with John the Ripper

Can you not just boot from the install media or into single user mode, mount your root fs from there and either edit /etc/passwd and shadow, run the passwd command against root or for a bit of fun run John the Ripper against it!

These two methods work for the passwd method http://aplawrence.com/Linux/lostlinuxpassword.html OR http://www.linuxforums.org/security/..._password.html (from this very site)

Last edited by DT0X; 11-07-2008 at 04:10 AM.
 
Old 11-07-2008, 04:12 AM   #6
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
There are two methods which I would consider very easy:

1. Boot with a live cd, mount the partition which has /etc, then edit the passwd file so that 'root' has no password. Simply delete the 'x' in the password field and leave the password field blank; that means no password is needed to log on.

2. Boot with "init=/bin/bash" (or /bin/ash - or whatever shell is available in the initrd image - or the final system if you do not use initrd). Once in the shell you can edit the passwd file as in (1). Shutting down the computer in a sensible way could be a challenge - perhaps you can call 'exec' on the real init script and hope everything goes fine - otherwise, 'sync' and pull the plug when the sync is done (yeah, bad advice, but if you're desperate ...)
 
Old 11-07-2008, 02:28 PM   #7
skaynum
LQ Newbie
 
Registered: Dec 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Root password recovery

I am using fedora 8, i have tried to mount the partition with the/etc directory but it refuses to mount stating badfs or badblock event after using mount with -t ext3 which is the filesystem am using.
 
Old 11-08-2008, 12:43 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by DT0X View Post
What version of Linux is it?

You can recover it - might take some time though and is kinda pointless - with John the Ripper
Strictly speaking, John doesn't recover anything, it just guess passwords that match a given hash. The password is not stored in any place, nor even encripted. Only the md5 hash is stored in the shadow file, and that's one way only, it can't be decrypted.

In any case, even if it's true that a working password will do, it's not that easy to get a password on a real system unless root is mentally diminished. Any serious password of an average complexity and with an adequate length would take forever to be "guessed" with the technology we have nowadays.

John just like cracklib serves an only purpose: to check the sanity of the passwords of your users. If john can crack it, then that password should not be on your system (remember: the first step to becoming root is becoming a regular user, most of the times).


Quote:
Originally Posted by skaynum View Post
I am using fedora 8, i have tried to mount the partition with the/etc directory but it refuses to mount stating badfs or badblock event after using mount with -t ext3 which is the filesystem am using.
Quote:
Originally Posted by skaynum View Post
I have been able to mount the /boot partition only and when i chroot into it it says /bin/bash could not be executed no such file or directory.I have tried to mount the other partition and it gives the error bad fs or bad block,what could be the problem?
You can't chroot into boot, you chroot into the root partition, that's what you should be mounting. If you can't mount it, then either you are using the incorrect file system, or the volume is damaged. So, first thing first: you should first sort the partition issue. Until then there's little you can do.
 
  


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
Password Recovery in Edubuntu 7.04 - In Terminal, Root Login : su , password : ????? farhannaeem13 Linux - Security 3 11-30-2007 09:59 AM
Root password recovery Jabber Linux - Security 6 11-27-2005 04:23 PM
Root Password Recovery ? Pravat Linux - Security 1 04-24-2005 04:46 AM
Password Recovery (not root) NewbGhostShells Linux - Newbie 3 12-17-2003 03:03 PM

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

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