Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 02-07-2005, 12:03 PM   #1
LQ Newbie
Registered: Jan 2005
Posts: 11

Rep: Reputation: 0
Recovering Linux Password.


I changed my linux root password. But now I can't remember the new password and I can't do any aministrative tasks.

But I still have my normal user account. Is there a way that I can recover my root password or will I have to reinstall linux again.

Best regards,
Old 02-07-2005, 01:20 PM   #2
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
AFAIK you can do it 3 ways:
-you remember the password
-try to crack the password file with something like Jack the Ripper
-easily change it if you have a rescue disk like Knoppix

See which one suits you best and let us know. Anyway, maybe somebody has other suggestions.
Old 02-07-2005, 01:32 PM   #3
LQ Newbie
Registered: Feb 2005
Location: TN
Distribution: aix,sco,redhat,xp,server2003
Posts: 9

Rep: Reputation: 0
try this

this is what i do . hope it helps.

On an x86 system using GRUB as the boot loader, use the following steps to boot into single-user mode:


If you have a GRUB password configured, type p and enter the password.

Select Red Hat Enterprise Linux with the version of the kernel that you wish to boot and type a to append the line.

Go to the end of the line and type single as a separate word (press the [Spacebar] and then type single). Press [Enter] to exit edit mode.

Back at the GRUB screen, type b to boot into single-user mode.

then passwd root
and change it.
Old 02-10-2005, 11:30 AM   #4
Registered: Aug 2004
Posts: 43

Rep: Reputation: 15
this is real easy!

step 1
download a iso of KNOPPIX distro of linux

step 2
burn it on cd

step 3
boot from cd

step 4
when o.s. is loaded open command shell

step 5
type in commandshell : su
now you a root users

step 6
in commandshell: mkdir /mnt/temp

step 7
typ in commandshell: fdisk -l /dev/hda
now take a look to see what is you / harddisk

step 8
in commandshell: mount /dev/hd* /mnt/test ( where * is your / as listed in fdisk -l /dev/hda)

step 9
vi /mnt/test/etc/passwd

step 10
delete the password line from the root to nothing

step 11
reboot and your done
Old 02-10-2005, 11:45 AM   #5
LQ Newbie
Registered: Jan 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks a lot guys

Hi people,

Thanks a lot for your help. It really was very useful.

I was planning to reinstall linux, But your advice saved me a lot of time and from trouble.

Best regards,

Last edited by chamalsl; 02-10-2005 at 11:47 AM.
Old 02-10-2005, 02:18 PM   #6
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
It can be done in only 3 steps using Knoppix:

1.'mount -t ext3 /dev/hdN /mnt/hdN'

2.'chroot /mnt/hdN /bin/bash'

3.'passwd root'

where hdN is the partition where '/' is mounted.

That's all.
Old 02-14-2005, 12:16 PM   #7
LQ Newbie
Registered: Feb 2005
Posts: 12

Rep: Reputation: 0
if u dont have grub password set it is very easy

step 1

when the grub loads just click on the linux o.s and press
"e" for edit

step 2
go the line
kernel ....................
press enter
at the end of line leave a single space and type single

step 3
go back to the grub
and load
u will get
sh# passwd root
and change the password


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
recovering root password isaacvimal Red Hat 3 04-02-2005 09:47 AM
How can I change e-mail password(or linux account password) with php in website?? yusuf Programming 1 05-28-2004 10:39 AM
Recovering XP Password using Knoppix doctor_damien Linux - Newbie 6 05-03-2004 04:09 AM
Recovering Lost Admin. Password Mr Neroazzurri Linux - Security 4 03-14-2003 06:26 PM
recovering root password in rh using lilo farhan Linux - General 1 03-01-2003 09:45 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration