USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

Recovering from a lost root password
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » System Administration and Security
View previous topic :: View next topic  
Author Message
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Thu Apr 21, 2024 7:42 am    Post subject: Recovering from a lost root password Reply with quote

Ok.... it finally happened to me...... lol.

You'd think that I wouldn't forget it, but I lost my root password to my Mandrake box. Since it's in high security mode all the time, it asks me to change my password every so many days..... guess what, I forgot what I had changed it too last.

Luckily it's an easy fix if you have physical access to the machine.

Slax to the rescue Smile

Using the live linux cd Slax, I loaded slax into the ram (so I could access the cd burner Wink ). I proceeded to make a much needed backup from slax, as the bios on the computer was acting flakey and I didn't want to take the chance that I wouldn't get another chance !

After making my backups with k3b using Slax, I decided it was time to fix that pesky "I forgot the root password" thing.

Open a terminal window.
Code:
/mnt/hda1

then do
Code:
chroot /mnt/hda1

and finally run
Code:
passwd


Which changes your root password on your hard drive..... pretty easy, and a quick way to remedy what is a very frustrating moment.

Now some would say this is a glaring security hole, no.... it isn't, that's why protecting the machine physically is VERY important. Securing the computer physically, is as important as it is to secure the network it's on. They go hand in hand.

The internet is filled with many ways to fix a lost root password mistake, but this one was the easiest one I've found to date.

Note to self.... I really need to turn off that uber security thing on mandrake Laughing



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
coastie
Moderator Bot


Joined: 24 Apr 2024
Posts: 3064
Location: The Fox Den in the Big Easy

PostPosted: Thu Apr 21, 2024 8:00 am    Post subject: Reply with quote

Laughing pretty funny. good info thanks crouse.

which slax did you use Confused



_________________
Ubuntu on the thinkpad
Easy Peasy on the EEEPC
Desktop is down.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Thu Apr 21, 2024 8:26 am    Post subject: Reply with quote

Slax 5.0.1 ...... worked GREAT. Wink



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
coastie
Moderator Bot


Joined: 24 Apr 2024
Posts: 3064
Location: The Fox Den in the Big Easy

PostPosted: Thu Apr 21, 2024 8:57 am    Post subject: Reply with quote

have you done the webconfig yet ?



_________________
Ubuntu on the thinkpad
Easy Peasy on the EEEPC
Desktop is down.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
RootLinux
Advanced Member


Joined: 04 Dec 2024
Posts: 940
Location: Tennessee

PostPosted: Thu Apr 21, 2024 9:56 am    Post subject: Reply with quote

Smile Good info to know.
Thanks. Very Happy



_________________
Mandrake 10.2 LE 2024,Xandros Desktop 3 Deluxe, Slackware 10,Linspire FIVE O,Slax 5.0.4
Back to top
View user's profile Send private message
Germ
Keeper of the BIG STICK


Joined: 30 Apr 2024
Posts: 12452
Location: Planet Earth

PostPosted: Thu Apr 21, 2024 10:42 am    Post subject: Reply with quote

1- boot to single user mode
2- passwd
3- set new password
4- good to go



_________________
Laptop: Mandriva 2024 PowerPack - 2.6.33.5-0.2mnb
Desktop: Mandriva 2024 Free - kernel 2.6.33.2-1mib
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
sasha
Sr. Member


Joined: 05 Nov 2024
Posts: 1911
Location: Warsaw, Poland

PostPosted: Thu Apr 21, 2024 12:51 pm    Post subject: Reply with quote

Yes, if you take a look at the "Server Hacks" book that you have, there's a section that explains how to boot into a shell directly by throwing a simple command to the bootloader and mount hda1 writable to change the password. I have to find my old photocopies and take a look.



_________________
OpenSUSE 11.1 kernel: 2.6.27.7-9-pae
Back to top
View user's profile Send private message
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Fri Apr 22, 2024 5:33 am    Post subject: Reply with quote

Germ wrote:
1- boot to single user mode
2- passwd
3- set new password
4- good to go


Yep, I was able to do that before on another machine, but not this one, I couldn't get to single-user mode.....which presented me with a small problem to overcome Wink

Like I said though "The internet is filled with many ways to fix a lost root password mistake" ..... not being able to get to single-user mode is what was kicking me in the shorts Laughing



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
Germ
Keeper of the BIG STICK


Joined: 30 Apr 2024
Posts: 12452
Location: Planet Earth

PostPosted: Fri Apr 22, 2024 11:30 am    Post subject: Reply with quote

Very odd. I've booted MDK to single user before. What was the prob?



_________________
Laptop: Mandriva 2024 PowerPack - 2.6.33.5-0.2mnb
Desktop: Mandriva 2024 Free - kernel 2.6.33.2-1mib
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Fri Apr 22, 2024 5:16 pm    Post subject: Reply with quote

Didn't have the install disks, and using SEL on it too. No option on the boot manager would let me get to single user mode ..... which i thought was odd too. Maybe it's a part of SEL ...... don't know.

Quote:

Single User Mode

Linux also provides two built-in rescue systems, one of them is the 'single user mode', aka runlevel 1. This 'single user' is 'root'. There will only be a minimum of processes running.

There are several ways to get into this runlevel:

*

From within a running system (as 'root'): init 1. Notice that this command will shutdown almost everything on your machine. It's also a popular way to simulate a reboot.
*

From the prompt of a boot loader: linux single or linux init 1. You might also be dropped off here when using the 'failsafe' boot option if the system can't go to runlevel 3.
There's no login required.


My problem was that
1. I didn't know the root password
2. I didn't have a prompt on the boot loader.......just a menu to select.
3. Booting failsafe always ended up with me in graphical mode as well...as it went to init 5.. (login screen).

Quote:

'failsafe' is a standard boot option in all Mandrake Linux systems.

Under normal circumstances, the system switches right into the preferred runlevel during boot ('3' for console, '5' for X). 'failsafe' on the other hand first boots into runlevel 1 (Single User Mode, see below), then tries to switch to runlevel 3 (console) and then, if 5 is the default runlevel, into runlevel 5.


.
.
.
.
I'm am SURE that there was probably an easier fix than what I did, but for the life of me i couldn't figure out what lol. Booting Slax and fixing it that way was the simplest thing I could think of.... worked slick too Wink



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
geeshock
Moderator


Joined: 02 Nov 2024
Posts: 1017
Location: Hertford, NC

PostPosted: Fri Apr 22, 2024 5:38 pm    Post subject: Reply with quote

Germ wrote:
1- boot to single user mode
2- passwd
3- set new password
4- good to go


This works with some distros. Others will need a password before you can get into single user mode. Eather tom's root boot floppy or the rescue cd is the safest bet. BTW dave, I've had to do the same on countless ocations, not becuse I forgot the passwd but becuse the passwd didn't take the way I wanted it to and I was locked out Smile


Back to top
View user's profile Send private message Visit poster's website AIM Address
smartcat99s
Jr. Member


Joined: 19 Dec 2024
Posts: 66
Location: Omaha

PostPosted: Fri Apr 22, 2024 8:31 pm    Post subject: Reply with quote

sasha wrote:
Yes, if you take a look at the "Server Hacks" book that you have, there's a section that explains how to boot into a shell directly by throwing a simple command to the bootloader and mount hda1 writable to change the password. I have to find my old photocopies and take a look.


I think that it would be adding
init=/bin/bash
and remount by using
mount /dev/hda1 / -o remount,rw

It's been a while since I've had to use this, so I may not be right.



_________________
Arch Linux - 2.6.28-blackice1 (custom based on git tree/tuxonice)
Back to top
View user's profile Send private message
Germ
Keeper of the BIG STICK


Joined: 30 Apr 2024
Posts: 12452
Location: Planet Earth

PostPosted: Fri Apr 22, 2024 11:18 pm    Post subject: Reply with quote

Quote:
2. I didn't have a prompt on the boot loader.......just a menu to select.


At the lilo splash, hit the "Esc" key. That takes you to a boot prompt. Type linux 1, hit "Enter".



_________________
Laptop: Mandriva 2024 PowerPack - 2.6.33.5-0.2mnb
Desktop: Mandriva 2024 Free - kernel 2.6.33.2-1mib
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Sat Apr 23, 2024 5:59 am    Post subject: Reply with quote

See..... I TOLD you there was probably an easier way Laughing Laughing Laughing Laughing



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
mmmna
. . . .


Joined: 21 Apr 2024
Posts: 7224

PostPosted: Sat Apr 23, 2024 10:19 am    Post subject: Reply with quote

I did this for the fun of it a couple years back; IIRC it went this way for me:
When you are at any prompt (knoppix from CD, a second distro on a different partition of the same hard disk, a boot floppy that can mount hard disks, etc.), and you are in a command environment that can mount and read and write your normal boot (hda1) partition, you only need a text editor and you can manually edit the /etc/passwords (/etc/passwd?) file, removing all the asterisks that come after the root entry. Save the file that you edited. Next time the system boots from the normal boot (hda1), just set a new password manually (issue the passwd command) if the system doesn't ask you to set a password.



_________________
-Kubuntu 10.04 LTS Beta2 on Celeron D desktop
-PCLinuxOS 2024 LXDE on EeePC 900A with Atom n270 (modded with 32G SATA drive and 2G ram).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » System Administration and Security All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse