Welcome, Guest. Please login or register.

Author Topic: Linux root password mystery  (Read 2688 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline orb85750Topic starter

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1237
    • Show only replies by orb85750
Linux root password mystery
« on: December 12, 2008, 06:23:09 AM »
Well, I inherited an older Redhat Linux box.  The problem is that I don't have the root password!  Unfortunately, I think I already know the answer to this question, but is there any way to circumvent having to reinstall a new OS?!?
 

Offline AmigaHeretic

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 821
    • Show only replies by AmigaHeretic
Re: Linux root password mystery
« Reply #1 on: December 12, 2008, 06:32:46 AM »
Sure,

right after you power on the computer start tapping "F8" about once a second...

Now you get a prompt, select "SafeMode"...

It will boot, but this time you will see a hidden account called "Administrator" above the account that you don't have the password for , click on this "Administrator" account.

Now go to control panel and you can just delete or change the password for the other account.  

Bam!!  You're a hacker!!


Oops, wrong OS... Sorry :-(

A3000D (16mhz, 2MB Chip, 4MB Fast, SCSI (300+MB), SuperGen Genlock, Kick 3.1)
Back in my day, we didn\'t have water. We only had Oxygen and Hydrogen, and we\'d just have to shove them together.
 

Offline LoadWB

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 2901
  • Country: 00
    • Show only replies by LoadWB
Re: Linux root password mystery
« Reply #2 on: December 12, 2008, 06:54:08 AM »
Yes, there is.  And a good Google search should help, or searching the Red Hat support area.

In short, you will need a Red Hat boot CD, or any other "live" CD which can access the filesystem type used for the system (probably ext2 or ext3.)  Mount the main (root) partition, navigate to /etc and work with the passwd (and/or shadow?) file(s).  Make backups of the files, first.

I've had to do this on a few Solaris boxes, so I have that process down-pat.  Linux I've only had to do once, so my vision is a little hazy.  There's probably a better (read that as easier) way, something along the lines of the Offline Registry Edition for Windows, but for Linux.

HOWEVER, you might want the experience of loading your own operating system, anyway, even if you stick with Red Hat.  You can use a "live" CD to copy the files you want off the system and then reload.
 

Offline orb85750Topic starter

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1237
    • Show only replies by orb85750
Re: Linux root password mystery
« Reply #3 on: December 12, 2008, 07:11:46 AM »
Thanks, now I need to find a RedHat CD, I suppose.  BTW, I love your TI 99/4A screenshot.  That was the first computer I ever owned.  Let's see, I suppose I was 11 or 12 yrs. old back then and doing more programming than I do now!  What a sad state of affairs.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Linux root password mystery
« Reply #4 on: December 12, 2008, 07:28:46 AM »
@orb85750

Basically you boot in single user, edit /etc/shadow file and remove the password for the root user, save changes, reboot. You typically do not need any boot CDs for this.

One neat trick is:
Add "init=/bin/sh" to linux kernel boot command.

Then in shell:
Code: [Select]

mount -o remount,rw /
passwd
(enter the new password when prompted)
mount -o remount,ro /
sync

And then reset the system.

Different linux versions might have other easier means to do it, though. You could also ask google, which gives you detailed instructions for Redhat such as:
http://www.go2linux.org/fedora-centos-root-password-recovery
http://kbase.redhat.com/faq/docs/DOC-1193
 

Offline banzai

  • Jr. Member
  • **
  • Join Date: Dec 2005
  • Posts: 66
    • Show only replies by banzai
Re: Linux root password mystery
« Reply #5 on: December 12, 2008, 08:12:52 AM »
Quote

orb85750 wrote:
Well, I inherited an older Redhat Linux box.

Just so we're clear here, which version of RedHat does it have? You see, RH dropped the "RedHat" name from all distros except their "Enterprise" versions (RHEL), and started using the "Fedora" name for the releases. That was about five years ago, as they release a new version of Fedora every six months, and they just got done with Fedora 10 (looks/works nice so far...).

Now, if you have anything earlier than Fedora 8 (like the box I'm using now), it would behoove you to just wipe and update with the newest distro. If there is data you're trying to grab, then Fedora 10 will boot in a "Live" mode, allow you to access the drive and pull off any data, then install over everything. NOTE: You'll need lots of RAM (512MB+) to boot a Live CD, although the HP Pavilion I have with only 300MB and 800MHz Celeron was able to do it - slowly.

Info, ISOs, and docs can all be found at the Fedora Project.

banzai
runnin' RedHat since 5.2!
 

Offline skurk

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 929
    • Show only replies by skurk
Re: Linux root password mystery
« Reply #6 on: December 12, 2008, 08:19:41 AM »
Boot into runlevel 1.  When dumped into a shell, change the password and reboot (or continue the init process)
Code 6502 asm or... DIE!!

[C64, C128, A500, A600, A1200, A3000, MBP+Mini, Efika/MOS2.1, Sam440 w/AOS4.1
 

Offline LoadWB

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 2901
  • Country: 00
    • Show only replies by LoadWB
Re: Linux root password mystery
« Reply #7 on: December 12, 2008, 01:24:02 PM »
Quote

skurk wrote:
Boot into runlevel 1.  When dumped into a shell, change the password and reboot (or continue the init process)


Holy Snapple... uh, so you "own" the box if you own it, huh.  Every step of the way in Solaris requires the root password.  Single user mode, kdmconfig, even breaking out of the boot process for filesystem maintenance (manual fsck, if you don't have it set in vfstab) requires the root password.  I'm disappointed. :huh:

Thanks for the nod to my TI screen.  That was also my first home computer, though my first computer (at school) was both the Apple ][+ and Atari 800XL (or 1200XL, I forget now... I think we got the 800s and the teacher used a 1200.)  I still have my TI around, with the PEB and some cards, all stock (no hacks) and I program it on occasion.  Mostly now it's become a thing of wonder for my friends' children... they LOVE the machine!
 

Offline yakumo9275

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
Re: Linux root password mystery
« Reply #8 on: December 12, 2008, 02:15:51 PM »
Quote

skurk wrote:
Boot into runlevel 1.  When dumped into a shell, change the password and reboot (or continue the init process)


wouldnt work on any of my boxes, you still need a password to log in. usually in this situation I just boot a live cd, mount the drive and remove the password from the /etc/passwd and reboot
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor
 

Offline Colani1200

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 707
    • Show only replies by Colani1200
Re: Linux root password mystery
« Reply #9 on: December 12, 2008, 02:46:18 PM »
Quote

LoadWB wrote:

Holy Snapple... uh, so you "own" the box if you own it, huh.


If you have physical access to a box, you always own it. No matter what system. (Using an encrypted filesystem can improve the situation though.)

Quote

Every step of the way in Solaris requires the root password.


Still it would be possible to take out the HD and mount it in another system.