Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-09-2008, 11:38 PM   #1
LQ Newbie
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
boot passwd lost

I forgot the boot passwd and i didn't set the user account. How can i
reset the boot passwd?
Old 11-10-2008, 01:07 AM   #2
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
Do you have available and are you familiar with a rescue boot disk or cd?

If you are then the short version is to mount your linux partition and edit the /etc/shadow file _of_that_partition_ if it exists or cat the /etc/passwd _of_that_partition. Almost all systems require editing the /etc/shadow file. Shadow systems store the passwords in encrypted form in /etc/shadow. Non shadow systems store passwords in clear form in /etc/passwd. The trick with shadow is to delete out the encrypted password field in the root line of /etc/shadow. The each line (one for each user) is a colon ( : ) separated fields with username (like root) user id # and so on. The line you want is the one for root and the field is the encrypted password, which looks like a cat danced on your keyboard. Something like


Having first backed up shadow

cp shadow

delete out that field leaving the colons alone


save as shadow then shut down. Remove the boot disk or cd and reboot. When you login as root, the system is fooled into thinking the root password has never been set, and asks for a new one.

Last edited by kevinalm; 11-10-2008 at 01:09 AM.
Old 11-10-2008, 01:29 AM   #3
Senior Member
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
IMHO opinion editing the shadow file is unnecessarily complicated and risky (although I believe the post above describes it correctly). I outline below two methods for simply using the passwd command. I had written the contents below and then I got delayed as a result of (ahem) "user error." For simplicity (for me) I am leaving it as I originally wrote it. Just realize I had written it before seeing the above post.


Welcome to LQ!

Do you mean the root password? Because you mentioned not setting up a user account, I am going to assume so ...

Just a note for future posts: It is a good idea to let us know what distro (name and version) you are using. Sometimes it makes no difference; frequently it does.

If you have the ability to get into single user mode w/o the root password, that would be the simplist way. You can tell the system to boot to single user mode (Ubuntu, and maybe others, call this recovery mode) by putting the numeral "1" or the word"single" on the kernel command line. Some distros already have an entry for this in the GRUB menu.

If you can't get into single user mode (because it requires a password you don't know), boot up from a live CD. Become root if you are not already. (On some live CDs you can use sudo su.) Mount your root partition and then chroot to it. (I am assuming sda1 is your root partition. Adjust to need & taste)

Depending on which live CD you use, the first step may be unnecessary.

mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
chroot /mnt/sda1
Whichever method (single user mode or live CD) you used you can now type:

It will prompt you for the new (root) password twice. If the you enter the same password (i.e. make no mistakes) it will tell you that "all authentication tokens" have been successfully updated, and you should be good to go.

EDIT: In the instructions above, I assumed /usr was on the root partition. This is probably true. But if /usr is on its own partition, then that partition must be mounted for the above methods to work since passwd is in /usr/bin. In the second method, /usr should be mounted before chrooting. I wouldn't worry about this unless you get a "command not found" when you try to run passwd.

Last edited by blackhole54; 11-10-2008 at 02:13 AM.
Old 11-10-2008, 06:08 AM   #4
Registered: Oct 2008
Posts: 100

Rep: Reputation: 15
I assume you mean the 'root' password. A 'boot' password could mean a BIOS password to allow system startup - in this case you should contact a computer store to reset that password on the hardware.

To change the 'root' password:

If you haven't done anything yet (no specific data since install), then do a re-install without disk formatting. Distributions usually will detect the existing system and since all the files are already in place, the install process shouldn't take long - at the final stage you add a new root password and create a new user.

Otherwise launch the PC with a rescue disk (these usually have a known root password documented somewhere), and remove the password entry in /etc/passwd and /etc/shadow to allow root access with an empty password. Later you can add a new root password.

Last edited by Tinkster; 10-30-2010 at 05:17 PM.
Old 11-10-2008, 10:47 AM   #5
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
Using passwd would probably work if you can successfully chroot into a proper working environment, but that is going to be kind of iffy. Editting shadow is certain to work.


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
Swat uses PAM but changes linux passwd not samba passwd Peter@KKVS Linux - Networking 0 11-26-2006 04:20 AM
Lost /etc/passwd, now UID/GID are different from before. Is this OK? gian2oo1 Linux - Newbie 2 07-05-2006 09:01 PM
Resized Linux Partition on Dual Boot - Lost Boot RationalRabbit Linux - Newbie 14 12-29-2005 01:02 AM
Lost username/passwd (Slackware 10.2) PastorFrederick Linux - Newbie 5 12-23-2005 09:15 AM
Lost root passwd and can't enter resuce mode musikalg Linux - Software 3 09-18-2005 08:33 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:25 PM.

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