Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications

A common problem faced by new users ( and sometimes even experienced users ) is not knowing what to do when they lose their password. Even worse, when they lose the password for 'root'. Luckily, there are several solutions to help you recover access to your system.

Root Password - Easy Method:

The simplest way to recover from a lost password is to boot into single user mode.

If you are using LILO, at the LILO boot prompt (graphical LILO users can press Ctrl-x to exit the graphical screen and go to the boot: prompt), enter:


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:



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.

Root Password - Not As Easy Method:

If for whatever reason, the above solution doesn't work for you, there is another option. Boot using a so called "Live CD" Linux distribution, such as Knoppix. For the purposes of this example, it will be assumed that the user is using Knoppix.
After booting up from the Knoppix CD, go to a terminal and su to root (no password is required). After your priviledges have been escalated, issue the following commands (be sure to replace each /hda1 with your own root ('/') partition):


mount -o dev,rw /mnt/hda1          cd /mnt/hda1/etc

Once you are into your system /etc directory, you can use a text-editor (such as vim, nano, pico, etc.) to edit the /etc/shadow file where the password is stored. Various information about root and user accounts is kept in this plain-text file, but we are only concerned with the password portion.

For example, the /etc/shadow entry for the "root" account may look something like this:



 (The '/' indicates a line continuation)

Now, using your favorite editor (I'll use vim) delete the password hash (the green text).


vim shadow

After you've edited this field, it should look like this:



Now save the file and change back to the root directory and unmount the system root partition (don't forget to change the /hda1) as follows:


cd / umount /mnt/hda1

Now reboot the computer.

Once the computer has booted and you're at the login prompt, type "root" and when asked for the password just press ENTER (entering no password). After a successful login, you need to set the new password for root using the following command:



Forgotten or Lost "User" Password:

If a regular user forgets his/her password, the root user can easily reset the user's password. For this example, the username will be "bob".

Enter (as root):


passwd bob

This will prompt for a new password for the user "bob".

Rate This Article: poor excellent
Comments about this article
One more thing...
writen by: Robin on 2006-03-11 21:05:09
This isn't the only way to change the root password on a system. This way kind of mixes both of the methods described on this page: You can boot using a LiveCD, then via a root terminal, you can chroot into your system after mounting it: [code] sudo su mkdir /mnt/hd mount /dev/hda2 -t ext3 /mnt/hd chroot /mnt/hd passwd [/code] Once you've filled in your password, it's done. Your root password is changed.
RE: One more thing... written by Robin:
Maybe I'm missing something, but
writen by: Monovitae on 2006-04-20 23:38:53
If these procedures work as explained dosen't it pose a significant security risk via anyone that has physical access to a machine?
RE: Maybe I'm missing something, but written by Monovitae:
Re: Maybe I'm missing something, but
writen by: Earnie on 2006-04-24 07:25:29
You haven't missed anything which is why you keep your servers under lock and key. You simply can't allow every Tom, Dick or Harry to have access to the system. Having access to the physical system is a security risk regardless of the OS or use of the equipment. CUID and passwords are at best only minimal advantage to the risk of security. CUID and passwords do not prevent anyone from accessing the data stored on the disk. If you have highly sensitive data that you do not want to be easily read you need to crypt it with something like openssl. People can still read the data but it minimizes the number of people to the ones with the know how in encryption technology.
RE: Re: Maybe I'm missing something, but written by Earnie:
Here's another..
writen by: Gagan on 2006-07-22 14:15:33
This works for most of Red-Hat and Fedora Core Systems, if you have GRUB as your Bootloader.! At startup just edit the line, where it's written Fedora Core or Linux and pass [quote]init 0[/quote] you will be automatically booted as root without even password confirmation and then you can reset the password using [quote]passwd[/quote]
RE: Here's another.. written by Gagan:
recovering the redhat linux pass
writen by: helion on 2006-08-17 09:54:40
the parameters to pass after the line starting with rh** in the grub menu is: init 1
RE: recovering the redhat linux pass written by helion:
writen by: helion on 2006-08-17 09:56:30
the parameter to be passed is: init 1
RE: it written by helion:
Hence the point of local security?
writen by: Brad on 2006-12-19 02:07:50
RE: Hence the point of local security? written by Brad:
root password
writen by: m.h.haque on 2007-02-13 12:26:06
RE: root password written by m.h.haque:
RE:Recover root password
writen by: jack on 2007-04-29 03:44:59
open this link and know how to recover root pass http://linuxera.com/content/view/191/2/ jack
RE: RE:Recover root password written by jack:
reset admin password for xp pro
writen by: mark on 2007-06-23 13:31:01
does anyone know of a linux based program that would reset a admin password on windows xp pro i heard that there is one but can't seem to find it. thanks
RE: reset admin password for xp pro written by mark:
writen by: Anonymous on 2007-07-06 02:58:35
You can try Austrumi linux: <a href="http://cyti.latgola.lv/ruuni/index_en.html"> http://cyti.latgola.lv/ruuni/index_en.html</a> I remember using an old version to reset the Administrator password on a Windows 2000 machine; I don't know if it works with XP too.
RE: written by Anonymous:
I think you need version 1.4.0
writen by: ted jordan on 2007-07-09 17:27:59
RE: I think you need version 1.4.0 written by ted jordan:
root password
writen by: javed on 2007-08-29 00:29:15
I hav try this method but don't work in grub screen as it asks for paaword ie.it ask to press p to unlock .I am using redhat 2.4
RE: root password written by javed:
Ultimate Boot CD (for windows)
writen by: MidnighToker on 2007-10-20 18:33:47
RE: Ultimate Boot CD (for windows) written by MidnighToker:
break to password
writen by: harshil on 2008-02-06 02:27:06
RE: break to password written by harshil:
Root password recovery on linux
writen by: Aijaz Khan on 2008-09-15 01:00:40
RE: Root password recovery on linux written by Aijaz Khan:
root password breaking
writen by: srinivas on 2008-10-10 11:39:43
i have user password but i don't have root password. is it possible to break the root password?
RE: root password breaking written by srinivas:
writen by: hyma on 2008-11-26 23:51:57
RE: password written by hyma:
writen by: Anonymous on 2008-12-20 19:36:53
DEAR SIR i do not know how to speak english very good, my typing skills are poor and i either type in all caps or all lowercase. but i want to break root password. and recover my yahoo password. i am a retard.
RE: written by Anonymous:
writen by: emi on 2009-01-12 10:58:33
It's because you login to root by sudo instead of su or plain login. This means that root acces is only permited to some users, normally those added to admin group.
RE: written by emi:
writen by: emi on 2009-01-12 11:04:16
Yahoo is an enterprise, not your own computer. Please, think a little before posting and spamming. For yahoo assistance, go to yahoo and look for it on their page. If you're looking for hackers to recover your stolen password, this is not the place (and, going as you're doing here, no one is going to help you).
RE: written by emi:
Works perfectly!
writen by: feradz on 2009-02-08 16:45:15
Thanks for sharing this how to. Was really useful for me.
RE: Works perfectly! written by feradz:
Reset the root password on a linux box
writen by: digitalpbk on 2009-03-03 06:51:15
[url]http://digitalpbk.blogspot.com/2009/03/reset-root-password-linux-fedora-debian.html[/url] Those steps worked for me.
RE: Reset the root password on a linux box written by digitalpbk:
kubuntu media issues
writen by: jaydee011 on 2009-07-01 12:00:59
does this works for kubuntu (my laptop dual boots kubuntu
RE: kubuntu media issues written by jaydee011:
suse with grub.
writen by: nsikkandar on 2009-07-07 11:24:15
I am using Suse, grub as boot loader. On boot option we can enter 'init=/bin/bash' (without quote), which takes to prompt, where we can change password using 'passwd' command. Very simple :-)
RE: suse with grub. written by nsikkandar:
You might want to consult a dictionary
writen by: DanielBuus on 2009-09-05 10:45:50
And get an understanding of what "recovering" means. This article describes nothing of the sort. Completely useless. Thanks for nothing.
RE: You might want to consult a dictionary written by DanielBuus:
Video Example
writen by: hardykriz on 2010-01-24 19:44:59
RE: Video Example written by hardykriz:
RE: Video Example
writen by: hardykriz on 2010-01-24 19:49:00
Use this url

Reply to hardykriz:
Reply to hardykriz
writen by: hardykriz on 2010-01-24 19:50:06
Reply to hardykriz:
Reply to hardykriz
writen by: hardykriz on 2010-01-24 19:52:12
Reply to hardykriz:
Reply to hardykriz
writen by: hardykriz on 2010-01-24 19:53:59
The complete url cannot be pasted here

Go to techvideolessons.com and find the video under Linux category

Reply to hardykriz:
what this article does
writen by: Xheralt on 2010-04-07 05:15:54
Mr. Buus, next time look at the OP's phrasing a little more closely before you start nitpicking -- this isn't about "recovering A lost password", i.e. getting the exact password, this is "recovering FROM A lost password", dealing with a situation that exists. Furthermore, what good is ANY password if it can be determined by an arbitrary person executing specific commands? Which seems to be what you want to do. Wiping/replacing the password is the only secure option; even if done by an intruder, it doesn't give away any clues to a hacker about what sort of password the target originally chose.

This article provides exactly what it says it does, even if it wasn't what *you* wanted. But that is an honored tradition in Linux, if you've ever read man pages ;)

Besides, if one is speaking of "recovering", its usually in the context of "getting control of my system back in the least destructive fashion." That too, is accurately provided by the OP.
RE: what this article does written by Xheralt:
Password Genius
writen by: rcmichelle on 2010-08-24 03:55:10
you can try to google Password Genius
RE: Password Genius written by rcmichelle:

Comment title: * please do not put your response text here