LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-15-2009, 01:00 AM   #1
spdthespeed
LQ Newbie
 
Registered: Sep 2009
Location: bangalore,india
Distribution: RHEL5
Posts: 11

Rep: Reputation: 1
Smile i forgot my root password


i am using rhel5.1 ,x86.............

pls teach me how to reset my password...........?


i tried
ssh-3.1# passwd
command in init level 1.....but it is not working



 
Old 09-15-2009, 01:06 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
Recovering root password should not be too difficult.
At grub prompt press "e" to edit the options and at the end of kernel line add 1 and press enter.
Highlighting this edited line, press "b" to boot with new parameters.

You will be put on a shell with root privileges.
Use passwd root to change the root password.
 
Old 09-15-2009, 01:06 AM   #3
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
boot your machine in single user mode.. in /etc/passwd file against your root entry you may find an an x..delete that x and reboot again.. i think that helps.try it at your own risk(also dont try it on machine that you are not supposed to do).
 
Old 09-15-2009, 01:10 AM   #4
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by spdthespeed View Post
i am using rhel5.1 ,x86.............

pls teach me how to reset my password...........?


i tried
ssh-3.1# passwd
command in init level 1.....but it is not working




did you actually boot to runlevel 1?? if not, this is what you need to do.

whilst booting, at the grub window, press the e key. select the image you would like to boot then press the e key again. move the cursor to the end of the line, append a space then the number 1.
then press b.
this will boot to single mode. then run the passwd command.
this normally always works.

the fact that you reach this stage
Code:
ssh-3.1# passwd
and you say it doesnt work seems a bit odd as it looks like you are actually the root user at this point. any errors to report?
 
Old 09-15-2009, 01:12 AM   #5
strycnine
Member
 
Registered: Jul 2006
Location: Romania
Distribution: Fedora 12
Posts: 160

Rep: Reputation: 31
There is another way...
Start a livecd linux... open /etc/shadow from livecd system, copy the encrypted password from root(or the whole line), and pasted in /etc/shadow from your rhe system...
I think it will work.
Take an livecd that tell's you the root password, or change it with passwd, and then do the copy...
good luck
 
Old 09-15-2009, 01:15 AM   #6
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
Quote:
Originally Posted by strycnine View Post
There is another way...
Start a livecd linux... open /etc/shadow from livecd system, copy the encrypted password from root(or the whole line), and pasted in /etc/shadow from your rhe system...
I think it will work.
Take an livecd that tell's you the root password, or change it with passwd, and then do the copy...
good luck
i didnt get you.. can you explain it??
 
Old 09-15-2009, 01:24 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
He means to copy the known password directly. Some live cds will ask you to provide password for logging in.
This passowrd will be stored in the passwd and shadow files on the cd.
He wants entry from the known file to be copied to other.
But changing the password from rescue mode is easier.
 
Old 09-15-2009, 01:27 AM   #8
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
then two users having same password should have same entry in the shadow file.. am i getting it right.. can that happen?i dont think so..
 
Old 09-15-2009, 01:37 AM   #9
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
Quote:
i didnt get you.. can you explain it??
I have not tried the above, but I have done similar to it. Boot from a Live CD. Mount the `/` partition of the existing OS. Open the `/etc/passwd` file on the mounted file system. Delete the password field from the root user, eg:

root:x:0:0:root:/root:/bin/bash

Delete `x` from the above. Save the file and reboot it. You are at the login prompt. Just give the root user and password (hit enter). You will be logged in as root. Just open the `/etc/passwd` file and put back the `x` there. You can use `passwd` to change the password.

Regards,

--
Prasanta
 
Old 09-15-2009, 01:46 AM   #10
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
@ prasanta how does your suggestion differ from my post #3 except that you are using a live cd instaed of being in single user mode..also you didnt mention anything about /etc/shadow. i have doubts with /etc/shadow file.
 
Old 09-15-2009, 01:55 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
Quote:
Originally Posted by mobinskariya View Post
then two users having same password should have same entry in the shadow file.. am i getting it right.. can that happen?i dont think so..
Exactly. even the same passwords are represented differently in shadow file. I just created a test user and assigned same password as mine and the shadow entry was different.
 
Old 09-15-2009, 02:00 AM   #12
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
if they were same then a root user can easily guess the users password if it is same as that of root(a big security flaw)..in linux we cant recover a password but change it(reason md5 hashing).. it is a good security option out there in linux.. i was sure about that because i have already studied it in Security In Computing..i think i made my point clear.

regards
mobin
 
Old 09-15-2009, 02:24 AM   #13
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
Quote:
@ prasanta how does your suggestion differ from my post #3 except that you are using a live cd instaed of being in
Yes, the solution is similar. The replied was missed out inadvertently.

Regards,

--
Prasanta
 
Old 09-16-2009, 06:18 AM   #14
spdthespeed
LQ Newbie
 
Registered: Sep 2009
Location: bangalore,india
Distribution: RHEL5
Posts: 11

Original Poster
Rep: Reputation: 1
hmm...........finally my password is resetted.........

thanks to linuxlover.chaitnya,strycnine,centosboy,mobinskariya,prasanta

for ur good response........
 
Old 09-16-2009, 06:26 AM   #15
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
Quote:
Originally Posted by spdthespeed View Post
hmm...........finally my password is resetted.........

thanks to linuxlover.chaitnya,strycnine,centosboy,mobinskariya,prasanta

for ur good response........
Nice to hear that. You could tell how you did that so that other newbies coming here for same issue could get help out of this.
Also if you think that your issue is solved, mark the thread as solved from thread tools.
 
  


Reply


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
How to retrieve( or reset) root password in Mandrake Linux, as I forgot my password? Reghunath Linux - Software 4 05-08-2008 04:11 AM
forgot root password wetbird Suse/Novell 2 12-16-2006 04:52 PM
Forgot root password k1ll3r_x Suse/Novell 6 05-05-2005 03:37 PM
forgot root password. How can I... 95se Linux - General 7 10-28-2003 01:12 AM
forgot root password juno Linux - General 7 05-11-2003 08:05 AM


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