View Full Version : HOWTO: Oh no! I forgot my password!
jdong
November 7th, 2004, 05:37 PM
Q: I am a complete moron and forgot my password. How can I get back into my system?
(Hey, YOU forgot it, I think that gives me the right to do some degrading before letting you back in!)
A:
1. Turn off your computer.
2. Tap it 3 times
3. Say your favorite magic word.
---- If that doesn't fix your problem, do the steps below... #-o
4. Turn your computer on.
5. Press ESC at the grub prompt.
6. Press e for edit.
7. Highlight the line that begins kernel ........., press e
8. Go to the very end of the line, add rw init=/bin/bash
9. press enter, then press b to boot your system.
10. Your system will boot up to a passwordless root shell.
CAUTION: This is a FULL ROOT SHELL! You can damage your system if not careful!
11. Type in passwd <username>. Set your password.
12. Type in reboot.
NOTE: steps 1-3 may help at this point.
13. Bow down to me....
plasmo
November 9th, 2004, 05:00 PM
what if i put a password on grub and i forgot that as well? \\:D/
fng
November 9th, 2004, 06:02 PM
this doesnt look safe at all to me.
If a hacker gets physical access to my ubuntu box, he will get a full-access root shell :(
jdong
November 9th, 2004, 08:27 PM
this doesnt look safe at all to me.
If a hacker gets physical access to my ubuntu box, he will get a full-access root shell :(
Err, if a hacker gains physical access to any computer, it's just as good as compromised!
Whether it's Linux or Windows or any other OS, there are always little backdoors. The most common is a Knoppix LiveCD: perfect for changing /etc/passwd , /etc/shadow, and the SAM file on XP (i.e. zero'ing out passwords, etc).
the best way to guard against this "exploit" is to keep your computer safe (duh) and set up a GRUB password as a deterrent. Then again, a Knoppix LiveCD (or Ubuntu LiveCD) is an easy way to mount the hard drive and edit /boot/grub/menu.lst to remove the password (hint, hint, hint)!
oddabe19
November 9th, 2004, 10:05 PM
set a bios password for startup. And assuming that they don't open your compy and reset the CMOS.... they won't get very far.
shimon
November 11th, 2004, 07:53 AM
get lock on your box lock your room... lock everything
HungSquirrel
November 11th, 2004, 08:12 AM
Both my case's side panel and the front panel covering the drives and switches have locks, I have a BIOS password, I have a GRUB password, I have set sudo sessions to three minutes, and I have xscreensaver set to come on after five minutes and lock the screen.
Not that I'm paranoid.
ghettobanana
April 18th, 2005, 08:12 AM
what about this problem:
I was editing my /etc/sudoers file to remove firestarter and was talking to someone when i # the wrong line. Now I can't sudo anything.
I #'ed the %admin ALL=(ALL) ALL
I need to edit this file and of course I can't.
# 1: (fail)
I edited my GRUB with init=/bin/bash
and once at the root prompt I nano /etc/sudoers
I was unable to save the file...says its read only.
Any advice?
jdong
April 18th, 2005, 11:06 AM
Read the instructions more carefully. You need rw before init=/bin/bash...
rah
September 4th, 2005, 03:00 AM
I tried to change my password using System > Administration > Users and Groups, but when I tried to login again, it wouldn't let me. In order to rescue myself, I tried using this technique, but when I get to the root shell, my keyboard is non-responsive. What should I do now?
EDIT:
Okay, instead of typing
rw init=/bin/bash
I typed
single
and it worked fine.
jdong
September 4th, 2005, 10:06 AM
By default, "single" would work. But by reconfiguring /etc/inittab, you require a password for single-user mode, in which case single would not be effective anymore ;). init=/bin/bash works regardless of system configuration.
Digicon
August 27th, 2006, 04:22 PM
Just wanted to say thanks you saved me alot of time.
I was just about to a reinstall. Thanks again!
cooldude95
August 9th, 2007, 04:48 PM
Just start in command mode, type in passwd yourusername, type in your new password, restart in normal mode, finish :)
Epilonsama
August 9th, 2007, 04:53 PM
Damn not even linux is safe against hackers :(
psusi
August 9th, 2007, 05:47 PM
Damn not even linux is safe against hackers :(
Such a statement is both meaningless and baseless.
fatsheep
August 9th, 2007, 07:37 PM
Thanks for the guide. Hopefully I will never need it! ;)
Spam Banjo
August 30th, 2007, 06:17 AM
Awesome... Can confirm that this method worked for me.
I'm a little gutted now... I didn't think it would be that easy to get in without a password. Not only get in... but potentially lock me out.
Ah well..! I'm used to upgrading my security methods... that's one of the reasons I swapped from Windows in the first place.
jdong
August 30th, 2007, 09:53 AM
Physical security is an important thing. If someone has physical access to your computer, no piece of software in the world can protect you from what he wants to do.
Bottom line is that your computer should be totally out of reach from dangerous people.
Neo_Me
September 22nd, 2007, 02:55 PM
I dunno much abt Ubuntu .. still
My Username was nm
From Boot Menu .. Selected recovery mode
passwd nm
typed new pass
again typed new pass
reboot
Logined successfully with new pass
penguinv
October 28th, 2007, 05:48 PM
Thanking you JDong for this last bit.
And for being clear at it.
OK one thing. What is GRUB? I inferred that when I am asked for my password on bootup that that is GRUB. But I am not certain of that.
(I went to the Ubuntu IRC and the FUD was thick. But that is another post.)
I won't make the sin of changing the thread and asking anything new
and
I see that this is the way I can change "who" (which username) is the "master admin" (the one who has the sudo password).
I started out being "sam" and then realized that I wanted the group (who own the computer) to have the master password so I created an account for some future person "sadmin" then found out only my password worked for installing updates, not the sadmin account.
I want to give them an admin account and the master password but not the one to MY account. --Yes I know they could find it but they are not that clever and "before I would leave" or anything, they should be able to always have the sudo-password.
And that way I can just ditch my entire account and not have to fuss with the details.
I have written this to check my thinking and to help others.
I prolly could have said this more clearly.
Thanks Jdong ultimate coffee master.
PenguinV
Los Angeles Newbie and very happy to be in GUIland Linux
jdong
October 28th, 2007, 06:22 PM
Nope -- the thing that plays the drums and prompts for your password is "GDM" (GNOME Display Manager)
GRUB is the textmode thing that provides the boot menu (or the PRESS ESC TO SEE MENU countdown) the very first thing during bootup.
penguinv
October 29th, 2007, 05:42 PM
Jdong you said:
4. Turn your computer on.
5. Press ESC at the grub prompt.
6. Press e for edit.
7. Highlight the line that begins kernel ........., press e
8. Go to the very end of the line, add rw init=/bin/bash
9. press enter, then press b to boot your system.
10. Your system will boot up to a passwordless root shell.
CAUTION: This is a FULL ROOT SHELL! You can damage your system if not careful!
11. Type in passwd <username>. Set your password.
12. Type in reboot.
In my world:
Turn on
see the Unix rebooting slider
pressed esc
see it reboot in text
see the grub page
pressed esc
--Now I see a set of choices that includes 4 lines that all say kernel.
but here I am supposed to press e, so I do
then I choose that one that starts with kernel (very long line)
press e
add the text at the end
see the prompt for root ((shiver))
put in the exact text
passwd<sam>
then enter
I get bash: syntax error near unexpected token 'newline'
then I cant enter text any more.
(sam is the user name)
Turn computer off.
Begin again.
(this time it takes several tries till I can hit escape at the right time. I have to go for the keep hitting it till I see the unix slider before grub.)
...
I try the password instead of passwd<sam> I do
gooble12<sam>
same result
Would appreciate assistance.
And Thanks In Advance.
penguinv
October 29th, 2007, 05:48 PM
Thanking you JDong for this last bit.
And for being clear at it.
OK one thing. What is GRUB? I inferred that when I am asked for my password on bootup that that is GRUB. But I am not certain of that.
(I went to the Ubuntu IRC and the FUD was thick. But that is another post.)
I won't make the sin of changing the thread and asking anything new
and
I see that this is the way I can change "who" (which username) is the "master admin" (the one who has the sudo password).
I started out being "sam" and then realized that I wanted the group (who own the computer) to have the master password so I created an account for some future person "sadmin" then found out only my password worked for installing updates, not the sadmin account.
I want to give them an admin account and the master password but not the one to MY account. --Yes I know they could find it but they are not that clever and "before I would leave" or anything, they should be able to always have the sudo-password.
And that way I can just ditch my entire account and not have to fuss with the details.
I have written this to check my thinking and to help others.
I prolly could have said this more clearly.
Thanks Jdong ultimate coffee master.
PenguinV
Los Angeles Newbie and very happy to be in GUIland Linux
Update:
I discovered that I was still in a functioning bash shell
by typing something I knew was safe, ls
so what happened was that my input- text was not being echoed after the first input.
and inputing the same thing
passwd<sam>
or
passwd <sam>
gave the same error message.
psusi
October 30th, 2007, 03:04 PM
There is no "master sudo password". By default sudo is configured to allow members of the admin group to use sudo with their OWN password. If you want someone else to have sudo access, just add them to the admin group.
JohnnyGuest
October 31st, 2007, 12:47 AM
Thanks for posting! Saves me from a reinstall... again :P
What about if you forgot your user name as well? Should you create a new user with useradd?
jdong
October 31st, 2007, 07:45 AM
If you forgot your username, cat /etc/passwd and look for your username, or the user with ID 1000 (username:x:1000:1000:.....)
Limpan
October 31st, 2007, 12:55 PM
You're not supposed to leave the brackets, < and >.
If you try without them I'm sure it'll work.
haldean
November 1st, 2007, 03:34 AM
@penguinv: take out the brackets and it'll work.
penguinv
November 1st, 2007, 02:11 PM
- penguinv
I got it working. I had changed the user name.
I still wonder about these things.
1. after the first line in the bash shell the input text is not echoed
but the command I type in works just the same.
2. There might be something (basic) about linux that I could read and get the <brackets dont count> and other valuable pieces of information for which I do not know enough to ask.
To help others, these pieces of information were good.
- psusi
There is no "master sudo password". By default sudo is configured to allow members of the admin group to use sudo with their OWN password. If you want someone else to have sudo access, just add them to the admin group.
---- YES, I really needed to know that.
- jdong
If you forgot your username, cat /etc/passwd and look for your username, or the user with ID 1000 (username:1000:1000:.....)
---- Examining /etc/passwd revealed that
the (human) user accounts are numbered starting with 1000
- limpan
You're not supposed to leave the brackets, < and >.
If you try without them I'm sure it'll work.
- haldean
@penguinv: take out the brackets and it'll work.
Thanks to all.
Linux BASHer
November 4th, 2007, 08:34 AM
This isn't working for me.
I get a black screen after the reboot and when I switch to another terminal view (Control-Alt-F1) I get a message akin to "No resume image, doing normal boot."
But then it either just hangs there forever (if I appended to the line), and upon restart gives me the regular graphical login screen, or just immediately restarts in the regular login screen as well (if I delete the original line and replace it with the new line). Either way, the result is the same.
Has anything changed in 7.10, is it my configuration (it is a brand new, clean install-- I must have set the password or username wrong at install), or am I doing something wrong here?
Edit: Ah nevermind. Since it was a fresh-install, I realized I could just use recovery mode. Then I followed steps 11-12 to reset the password (sorry, no step 13 :P )
doorknob60
January 17th, 2008, 02:00 AM
I'm bumping an old thread, but this saved me from a reinstall on my brother's Xubuntu box :P Thanks this worked great!
EDIT: Hmm it doesn't have the star button thing to give you a "thanks" oh well
Coastalguy
November 21st, 2008, 04:59 PM
I too forgot my password when I installed Ubuntu. I followed the instructions provided on the above posts to use GRUB. I did and at the prompt, I entered "passwd" following by my username.
I did receive the "Enter New Password" prompt, however it only allowed my to enter a single character which then automatically gave me the "Enter Password Again" prompt, which also only allowed one character before getting a new command prompt.
I tried entering a single character twice, however when entering this as the login password, it still gave me a wrong password error.....
I had installed Ubuntu as a Windows XP Home application (I believe they call it wubi?). However, when I try to uninstall it via the Control Panel, or directly using the uninstall executable file, I get a little HD activity, which then just stops. If I try to do a re-install using the CD, the same thing happens.
So... I can neither login to my current install, nor can I remove it to reinstall it to obtain a new password.
Kow
November 22nd, 2008, 03:16 AM
this doesnt look safe at all to me.
If a hacker gets physical access to my ubuntu box, he will get a full-access root shell :(
This may have already been said but if a hacker gets physical access to your computer then you might as well tell them the password (or not even set one.)
Zipp Dementia
April 19th, 2009, 12:55 AM
Great thread, thanks!
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.