LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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-28-2007, 09:18 AM   #1
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
I lost root password.


Good Day,

Yeah, I lost root pass word on my linux(RH) machine.
I still have normal-user pass word. I can't much with non-root user account.

I was thinking starting machine with live cd and modify /etc/shadow file.

Any thoughts ?

Thank you.
 
Old 11-28-2007, 09:31 AM   #2
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
I think you can boot with a live CD, chroot to the root partition of your RH installation and then use the 'passwd' command as root. I'm pretty sure that will work for you...
 
Old 11-28-2007, 09:33 AM   #3
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Original Poster
Rep: Reputation: 33
^ Thank you.
 
Old 11-28-2007, 09:33 AM   #4
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
Found this. Seems to be very straightforward and will most likely help you solve your problem.
http://www.linuxforums.org/security/..._password.html
If you look below the main write-up there is a comment by another person- "One More Thing" - that is indeed the way I first suggested...so I guess I was right.

Last edited by Vincent_Vega; 11-28-2007 at 09:35 AM.
 
Old 11-28-2007, 09:40 AM   #5
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
As you would have noticed, if you had done a search before posting, there are already several threads about losing or "losing" root password, and answers to the question "how to get it back?" (well, you don't, but you can reset it).

Anyway, after this you'll hopefully understand why it's so easy to reset one's root password, and what to do at minimum to make it more difficult. The usual methods are as follows:

- booting into single-user mode (no live-cds needed); if you haven't set bootloader password, and are able to boot into single-user mode, a root login can usually be obtained without any passwords. passwd then changes the password..
- booting from a live-cd or connecting the harddisk into another machine will, unless the disk (or at least root partition) is encrypted, reveal the passwd and shadow files and enable basically anyone to erase the password field and have access to root account
- loose sudo configuration usually means you can get root login anyway, so unless your sudo configuration is nonexistent or very strict, that's a way to go too

Other methods exist, but those are the easiest.
 
Old 11-28-2007, 09:44 AM   #6
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
Well now this is just one more google link to LQ regarding lost root passwords!
 
Old 11-28-2007, 09:45 AM   #7
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Original Poster
Rep: Reputation: 33
^ you thoughts on "Easy method" ?

From same page::


Code:

#linux single


This will make you the "root" user without asking for a password. Once the system has booted, you can change the root password using the password command:

Code:

# passwd

The instructions for GRUB users are similar. Press 'e' at the GRUB prompt to select boot parameters. Select the line for the kernel you want to boot, and go to the end of it. Add "single" as a separate word, and then press ENTER to exit the edit mode. Once back at the GRUB screen, press "b" to boot into single user mode.
 
Old 11-28-2007, 09:48 AM   #8
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If Red Hat is like Fedora core and when you use sudo you enter your regular users password, you could try "sudo passwd".
 
Old 11-28-2007, 09:58 AM   #9
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
Quote:
Originally Posted by knockout_artist View Post
^ you thoughts on "Easy method" ?
Easy enough. Those steps are right-on. If you're using GRUB, you select your choice, press "e" to edit, add 'single' to the kernel line, press <ENTER>, and press "b" to boot. I have not done this myself but I have edited many grub entries at boot time.
Try one method and post back with your success or failure! We'll go from there.
 
Old 11-28-2007, 10:01 AM   #10
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
Quote:
Originally Posted by jschiwal View Post
If Red Hat is like Fedora core and when you use sudo you enter your regular users password, you could try "sudo passwd".
This is actually a great way also! For the sake of simplicity, I definitely suggest using this method first. I see no reason why this will not work for you.**
Good idea, jschiwal!

(edit)
** unless of course you are not a privileged sudoer!

Last edited by Vincent_Vega; 11-28-2007 at 10:08 AM.
 
Old 11-28-2007, 05:35 PM   #11
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Quote:
Originally Posted by Vincent_Vega View Post
This is actually a great way also! For the sake of simplicity, I definitely suggest using this method first. I see no reason why this will not work for you.**
Good idea, jschiwal!

(edit)
** unless of course you are not a privileged sudoer!
Someone who isn't a member of the wheel group wouldn't need to change the root password.

I tried it, but I didn't actually carry through with it. I ssh'ed into an old Pentium III laptop I installed FC 6 on and tried it out. I got a "new root password" prompt, and then bailed. This might be different in RHEL. A member of the "wheel" group could be able to do this to the main "root" user. However, the main administrator would probably also have a regular account and be a member of the wheel group as well, so it wouldn't be hard to run "sudo passwd" to create a known passwd and then look in the logs and see who did it. Assuming the "wheel" member didn't hide his tracks.

Last edited by jschiwal; 11-28-2007 at 05:53 PM.
 
Old 11-28-2007, 06:03 PM   #12
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
I should have thought out my last response better. If you have FC6 and you indeed have many users and different wheel users, that user could also remove the root users regular account from the "wheel" group locking the main administrator out. I think the fix would be to change a line in a PAM configuration so that the old root password would need to be entered first. This would make using "sudo passwd" to reset a forgotten password impossible however. So it really depends on how well you trust the "wheel" members. On a corporate server, if the wheel members are employee's the main administrator with physical access to the server could boot up in rescue mode, reset the root password the old school way and find out how need to be fired. If it were a remote server, then this convenience may need to be plugged.

Last edited by jschiwal; 11-28-2007 at 06:07 PM.
 
Old 11-28-2007, 08:02 PM   #13
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
So I assume RH and Fedora make everyone members or the 'wheel' group? You sort of lost me because being a privileged sudoer doesn't necessarily mean you're a member of any particular group. On my system, I can change the root password the way you suggested but I didn't bother putting myself into the wheel group.
Is that a standard for RH?
(edit)
...and has knockout_artist had any success with this? It's always nice to hear what everyone's help resulted in for those people who, in the future, have the same issue!

Last edited by Vincent_Vega; 11-28-2007 at 08:03 PM.
 
Old 11-29-2007, 05:41 AM   #14
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
If you have this line in /etc/inittab:

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

Then Single User mode will ask for the root passwd.
 
Old 11-29-2007, 05:44 AM   #15
Mostafa Magdy
LQ Newbie
 
Registered: Nov 2007
Posts: 22

Rep: Reputation: 15
Hello,password lost

i installed WUBI and i forgot the username and password that are asked to enter in before logging to ubuntu desktop.
what is the differnce between root password and this password ?
 
  


Reply

Tags
lost, password, root


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I have lost my root password. admiralpaul Linux - Security 5 07-13-2007 01:10 AM
Root password lost duvijan LinuxQuestions.org Member Intro 1 01-17-2006 07:53 AM
Lost root password amirdhagopal Suse/Novell 13 02-10-2005 12:09 AM
lost root password papitu76 Mandriva 12 10-31-2004 10:40 AM
lost root password dvong3 Linux - Newbie 2 06-13-2003 09:34 AM


All times are GMT -5. The time now is 05:41 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration