LinuxQuestions.org
Review your favorite Linux distribution.
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 05-29-2005, 02:11 AM   #1
luckyvietman
LQ Newbie
 
Registered: Feb 2005
Posts: 3

Rep: Reputation: 0
Lost root pass word


I have lost my root pass word and don't know how to recovery . Please help me. Thank you very much.
 
Old 05-29-2005, 02:27 AM   #2
Cron
Member
 
Registered: Jun 2004
Location: Lithuania
Distribution: FreeBSD, Arch, Ubuntu
Posts: 145

Rep: Reputation: 15
There is no way to recover it. But you can boot from live cd, edit your /mnt/yourlinuxpartition/etc/passwd and delete it completely, then restore it with loging in as root (no password) and running 'passwd'. Or if you have sudo installed and configured properly, you can run 'sudo passwd' and enter new root password.
 
Old 05-29-2005, 02:29 AM   #3
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
This is one way to do it

1. Download the Gentoo Minimal CD (any Live CD should work)
2. Boot the CD
3. Mount your partitions. like
    mount /dev/hda3 /mnt/comp    mount /dev/hda1 /mnt/comp/boot

4. Chroot to the mounted partitions and update the environment
    chroot /mnt/comp /bin/bash
    env-update
    source /etc/profile

As far as your machine is concernced, you are now running linux on your hard drive rather than the Live CD, so just change the password

    passwd root

5. Unmount and reboot
    exit
    umount /mnt/comp/boot
    umount /mnt/comp/
    reboot
 
Old 05-30-2005, 01:51 AM   #4
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
or, bootloader permitting (lilo-style):

boot: linux init=/bin/sh
(let it boot)
# passwd
 
Old 05-30-2005, 02:26 PM   #5
Sparkfist
Member
 
Registered: Feb 2004
Location: Michigan
Distribution: Mint 20.1
Posts: 69
Blog Entries: 1

Rep: Reputation: 15
Careful of using the lilo option if that is your bootloader. I had a laptop with SuSE 8 and it prevents you from entering in "Single User" mode.

Just a heads up.

P.S. I know that at the very least Grub packaged with Fadora Core 2 still offers "Single User" mode.
 
Old 05-30-2005, 07:35 PM   #6
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Quote:
Careful of using the lilo option if that is your bootloader. I had a laptop with SuSE 8 and it prevents you from entering in "Single User" mode.
I imagine it's a matter of editing lilo.conf to change that...

--Jonas
 
Old 05-30-2005, 11:23 PM   #7
emetib
Member
 
Registered: Feb 2003
Posts: 484

Rep: Reputation: 33
in grub
go to the kernel that you want to boot, e (edit) then put 'single' (no quotes) behind it, then enter, the b to boot it. once it's boots then passwd and you're set.

for the lilo, the above will apply. if the distro that you're running won't let you into the edit mode of lilo, then boot with a small live disk, like feather or dsl linux. you can then either mv the old /etc/passwd into place, which i suspect you have, (make a cp of the original one first) and then reboot.

once you learn the tricks, make sure that your buddies don't let you near their boxes on boot.
 
Old 05-31-2005, 03:10 PM   #8
Matty-J
Member
 
Registered: Jun 2004
Distribution: SuSE 9.3, Debian Sarge
Posts: 65

Rep: Reputation: 15
Hey,

Lil noob question, but it seems way too easy to reset the root password. Is this not a bit of a security flaw? If I set up a shared computer with Linux, I don't want someone with a little know-how to change the password on me, and then do as he/she pleases.

Am I wrong?

Thanks,
Matt

Last edited by Matty-J; 05-31-2005 at 03:18 PM.
 
Old 05-31-2005, 04:41 PM   #9
emetib
Member
 
Registered: Feb 2003
Posts: 484

Rep: Reputation: 33
with both lilo and grub you can specify a passwd to enter before you edit it. you can also specify a passwd so that it won't boot until you enter it.
 
Old 06-01-2005, 02:46 AM   #10
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Or just boot to single-user mode!
At the boot prompt, type
Code:
linux 1
If it's a graphical prompt, <Esc> should get you to a boot prompt.
Then you're logged in as root, just type
Code:
passwd
to change you password.
 
Old 06-01-2005, 03:27 AM   #11
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
Man, why does everyone else take the easy way out.

Actually, I've learned a few new and such easiers way than I used to do. Thanks everyone
 
Old 06-01-2005, 09:13 AM   #12
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
There's always an easier way with Linux!
 
  


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
Ubuntu doesn't ask for root pass during install?? Ay-Karamba! Ubuntu 1 09-02-2005 04:50 AM
root pass blank/redhat9 rohan208 Linux - General 3 05-07-2004 05:06 PM
I can't input root pass word . akihandyman Mandriva 3 03-18-2004 12:00 PM
MySQL root pass tommytomato Linux - Newbie 0 02-02-2004 06:34 AM
problem regarding on admin and root pass glacier1985 Linux - Newbie 5 07-13-2003 08:34 PM

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

All times are GMT -5. The time now is 04:27 PM.

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