Computing.Net > Forums > Linux > Forgot username/password-locked out

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Forgot username/password-locked out

Reply to Message Icon

Original Message
Name: MordredHaidar
Date: September 9, 2005 at 15:24:42 Pacific
Subject: Forgot username/password-locked out
OS: Ubuntu 5.04
CPU/Ram: N/A
Comment:

So, I've just done the dumbest thing ever...I've locked myself out of Ubuntu. Either the username or password I'm thinking should work isn't, I've tried just about everything it could be...so now I havew to work around it. Is there anything I can do that's quicker than reinstalling it?

Celeron Eater


Report Offensive Message For Removal


Response Number 1
Name: Paracomp
Date: September 9, 2005 at 18:11:08 Pacific
Reply: (edit)

Get a floppy or cd-rom bootable version of Linux such as knoppix. Boot that; then mount the hard drive such as #mount /dev/hda1 /mnt
Edit the /etc/password file for the user which will now be located as:
/mnt/etc/password. You might also need to remove (blank) the password entry for that user in /etc/shadow. You should b able to boot the original Linux and login.


Report Offensive Follow Up For Removal

Response Number 2
Name: Jake2
Date: September 9, 2005 at 23:27:33 Pacific
Reply: (edit)

First, the file is called /etc/passwd, not /etc/password. You should see your account name in the results of "tail /etc/passwd".

If Ubuntu uses GRUB, and I'm reasonably sure it does, all you have to do is press "e" when it briefly pauses before booting. You will then be able to edit the boot options. Go to the end of the line and enter "init=/bin/bash". This will bypass all startup procedures and give you root access. Run the "tail /etc/passwd" command I mentioned earlier to identify your username. Your root filesystem will be mounted readonly, so you'll want to run "mount -o remount,rw /". Then set your password with "passwd yourusername".

It's possible to password protect GRUB. If you encounter this, use Paracomp's method. You will need to edit etc/shadow. If you completely remove the longest string of junk between two colons, your password will be removed. Reboot, login, and set a new password with "passwd".


Report Offensive Follow Up For Removal

Response Number 3
Name: Paracomp
Date: September 10, 2005 at 21:37:52 Pacific
Reply: (edit)

Thanks Jake for the correction of /etc/passwd
Trying to get over a bout of pneumonia.


Report Offensive Follow Up For Removal

Response Number 4
Name: 3Dave
Date: September 12, 2005 at 03:50:30 Pacific
Reply: (edit)

With Ubuntu, in the grub boot menu simply choose "recovery mode", this will boot you up to a root prompt without asking for a password. Then you can set a password for yourself as Jake says with "passwd yourusername".


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home








Do you have a Desktop Computer anymore?

No
Yes, but only at work
Yes, but its rarely used
Yes, and its a workhorse


View Results

Poll Finishes Today.
Discuss in The Lounge
Poll History




Data Recovery Software