September 25, 2007 · General, Security · Email This Post

Sponsored Link
If you forgot you password for your ubuntu system you can recover using the following steps

Turn your computer on.

Press ESC at the grub prompt.

Press e for edit.

Highlight the line that begins kernel ........., press e

Go to the very end of the line, add rw init=/bin/bash

press enter, then press b to boot your system.

Your system will boot up to a passwordless root shell.

Type in passwd username

Set your password.

Type in reboot

Incoming search terms:

Related posts

86 Comments to “How-To Recover password under Ubuntu”

  1. dan says:

    All you arrogant linux-fanboys have really ruined and respect i had for the open-source community.

    Instead of being rational about the differences between windows and linux, you bicker, whine, bemoan, and insult anyone who disagrees with you. Its really disgusting.

    The worst part about it is how you are all so convinced that your operating system is vasty superior in every way to any other OS, which is ridiculous.. to say the LEAST.

    Linux will never penetrate the market much more than it already has. Its unsupported and extremely difficult to administrate for beginner users. Can you imagine your grandmother trying to master the console? -sudo … get…. wha? Its NOT user friendly.

    Windows has its security flaws, AND its stability issues. But thats the nature of the beast folks. Linux isnt all that much more stable than windows is. And the only reason we dont find more security flaws with it is because malware is typically developed to produce the most results, and since EVERYONE uses windows.. its a no-brainer.

    so get off your high-horses, and come back down to earth with the rest of the technology community. you cant learn anything if you think you already know it all.

    [Reply]

  2. Shane says:

    Dan, as a dedicated linux user I feel obligated to reply to you. Linux is gain market share more all the time. It’s expected that by the end of this year nearly 40 % of desktop systems will be running a version of linux. A majority of back-end systems and servers run linux now for the security and stability reasons alone. Personally, I have only had my linux servers crash once, which was when I wrote a very bad script. =)

    With Ubuntu, there are only rare occasions a beginning user will need the terminal. Everything else is able to be managed via the GUI. And once you get the hang of the terminal, administering the system is much easier then finding things in windows.

    Malware doesn’t run on linux becuase of the way the kernal works, not because there is no malware designed for linux. Program such as malware are not able to run without the user entering the password so they can’t run, unless you run as root all the time which would be stupid.

    [Reply]

  3. Luigi says:

    Also another difference between windows and linux. windows runs only computers, linux is able to be downgraded and run small enough so microwaves, stoves, and other things have linux kernels on them. and its $100+ for one windows cd, or free for any linux cd that youu can install on as many computers as you want for free.

    [Reply]

  4. HackerSeraph says:

    Dan fears what he doesnt understand. Lest we not forget, customers of Dell, HP, Acer, and Asus machines can now opt to have their machine shipped with linux and full customer service support ;)

    [Reply]

  5. Morthez says:

    Will this still work under 9.04? (havent had the opertunity to test yet)

    [Reply]

  6. Distant Thunder says:

    [quote]All you arrogant linux-fanboys have really ruined and respect i had for the open-source community.[/quote]

    Hem and hw do you do with Win-fanboys, who are ways more numerous than us, Linux-fanboys ? Well at least, Linux don’t eat 25% of you bandwidth, and you don’t have to buy a 100 $ more expensive version to get that stupid thing disabled, Ubuntu checks for updates when you login, and even when you’re working without swallowing the whole connection which is actually hard to do for win, & that’s only one of the tremendous amountof examples i can take to show GNU/Linux based OS superiority… Linux less stable than Win ? ‘kidding right ?

    [Reply]

  7. RTFM says:

    Dan is 100% right.

    Open Source itself seems to work fine. Mozilla’s products are doing very well, for instance. Server

    There’s just something special about Linux desktop users. They’re disproportionately arrogant, fanatical, and in denial about the flaws and impotence of their favorite OS. I’ve been using Ubuntu for more than two years now, and it sucks. Nothing works out of the box, every release breaks something that previously worked fine, and you get attitude from anyone you ask for help. It’s a nightmare constantly maintaining your system instead of actually using it to get things done, and I would never recommend it to anyone.

    [Reply]

  8. bored with prejudice! says:

    wow, both dan and RTFM fulfill their own psychological projections on their own. What can you tell me what you think you know about black people? Why ARE you so defensive? I have never been hesitant to have an honest and open discussion about OS efficiency, security and operability. This means that I have no problem with recognizing opportunities of improvement in all areas of open source software. so….how about you tell me what you think you know about other people you don’t know but are perfectly willing to judge and attack — not even criticize their actions in a fair and objective way but attack their character.

    sounds like every time I check a white supremacist on their prejudice — all that anger they harbor within comes rushing out in an attack on my character – as if that’s an appropriate response for anything.

    cmon, wifebeaters, I know you’re not used to using WORDS but let’s try this again….

    [Reply]

  9. bored with prejudice! says:

    and that question was directed more towards dan than RTFM. RTFM, from a software analysis and troubleshooting standpoint the very vague and generalized feedback is not very helpful. I’d begin by asking you the surrounding circumstances of what you upgraded, and exactly what software are you talking about anyway?

    Also, since this is open source software, that means it’s community supported. Would you care to support making the changes you so obviously want? Just food for thought. “Freedom ain’t free”, as the xenophobes in this US of A love to spout.

    [Reply]

  10. other dan says:

    To get back on topic: another user asked if this still works under 9.04. I have tried, and it almost worked – but oddly enough, when I tried to type in a new password, it only allowed me to type in 1 letter in the command line. That doesn’t feel right.

    Since I am newbie level 1 (or 0 even ;) ), it might well be that I did something wrong – advice, anyone?

    Everything else now works rather swimmingly with my one-letter root password. I´m just worried for security reasons.

    [Reply]

  11. other dan says:

    Oh, I found a way – thanks anyhow.

    [Reply]

  12. dabaum says:

    I followed the instructions, still no love. Very much a newbie. Any help. please.

    [Reply]

  13. Steve says:

    So… this works well and gives root access… but I still have an issue. After the point where I get root prompt, my USB keyboard (and a variety of them) no longer work. No PS2 I/O on a newer PC… suggestions?

    [Reply]

  14. Waheho says:

    I have completely forgotten the password and user name of a computer given by a friend that uses Ubuntu. How do I resolve this? Worst since I suspect that my kids changed the username and the password since the friend sent me the original username and password but still I cannot access it. THanks.

    [Reply]

  15. BadOmen says:

    There might be an other way of doing this but you can start the computer from a live ubuntu cd and check the names under the home folder, thats the users of the computer.

    Then restart the computer without the live cd and press ESC to get to the boot menu. Select the recovery mode option. Then you can select in a new menu “drop to root shell prompt” or something like that… Now in the root shell prompt type:

    passwd username-that-you-found-with-liveCD
    enter a new password for that one, you will not see stars or anything else. Press enter and retype it. then type reboot to reboot… :) then just log in with the username and the new password.

    I have not tried it in a while but something like that :)

    [Reply]

  16. jigglywiggly says:

    If this exploit is still valid, isn’t this a HUGE security vulneribility?

    [Reply]

  17. diego says:

    you can protect the grub with a password so that no one can edit any entry preventing from resetting your password. another nice idea would be to set a password as well to your bios menu so that no one can boot your pc with a live cd or such. Also since 9.10 it is possible to encrypt your home directory, so even if someone breaks into your house and smashes down your pc to take out the hardrive to mount it as a slave they wont see your /home.

    [Reply]

  18. Sun Congo says:

    This works beautifully!!! Thanks!

    – One letter password only, but good enough
    – Dont mind if the commands you type after tha are not visible, they work anyway…
    – If reboot or shutdown doesnt work, says something like conection refused message not sent, press Ctrl+Alt+Del… reboots. Do not use the power button or restart button.

    I DID IT ON 9.04

    [Reply]

  19. jangirke says:

    Can somebody just delete the trolling and get back to just serious questions and answers.
    (Food for the Troll: Look at ReactOS it will offer
    Win32 and POSIX compatibility, that’s way better
    than just linux.)
    Does that work on 9.10 too?
    Man it’s even easier than doing it in Windows.

    [Reply]

  20. jangirke says:

    I tryed it.
    GRUB shows a prompt and lets me choose even without using ESC or SHIFT.
    The password changing works but if you used cryptography for your home directory it will be locked until you can remember you old password.

    [Reply]

  21. georg says:

    I just survived it in jaunty.

    First i tried the safe mode method, but before granting me the root it asked for the password, so i was unable to use that.

    Then i tried to edit the kernel line in grub. Everything worked as described but when i used the reboot command it wouldnt work. So i did some silly things loging in and out and i finally used the exit command and got a lovely kernel panic — not syncing response. Well, i hit the reset button at that point.

    Ubuntu booted up normally, detected an unclean shutdown, did some work and self-restarted. Now everything is ok.

    The advice about pressing Ctrl-Alt-Del if reboot doesn’t work, should be added to the top post. I only read it now when i came to post my succes.

    [Reply]

  22. Athos says:

    I have both Windows and Ubuntu. I always use Windows but want to learn to use Ubuntu. Followed instructions but got stucked in the last step. When the system is booted it prompts me a black screen and something at the upper left corner like (name) then you can write. I thought here is where I type my new paswword, so did it, clicked enter and it did not recognized anything. Then I was unable to type anything eventhough there was a blinking cursor. So I turn off my machine and here I am writting, looking for any kind help. Forgot to mention that I also don’t remember my username. Is there any way to recover that doesn’t require to use the Ubuntu CD? Thanks in advance!

    [Reply]

  23. jeeva says:

    I’m using ubuntu 9.10.I’ve entered into root user of ubuntu. But i’ve forgotten the password. I wanna get my password back without changing that.. Anyone tell me the way to do that..!

    [Reply]

  24. robsku says:

    @jigglywiggly
    >If this exploit is still valid, isn’t this a HUGE security vulneribility?

    No it’s not, it’s a good feature that from LILO or GRUB boot menu one can start in single user mode to fix things – you CAN disable from grubs config files the possibility to edit boot options to prevent this but it won’t improve your security.

    That will only require the user to have a livecd, and this works for Windows too! With linux livecd named “Windows NT Password & Registry editor” you can disable any users password (or re-set them), with any livecd you can mount the linux partition, use chroot to get shell where the mounted drive acts as root (/) partition – after that just run passwd.

    Only way to protect someone with physical access to your computer from doing this is really setting up BIOS password – and even that won’t prevent user who can open up your hardware and put the HD on another computer. To secure from this kinds of things you may want to encrypt your whole harddisk – that way these things won’t work, otherwise there is no OS where they would not.

    [Reply]

  25. Bing says:

    I completely forgot my password. I tried doing those instructions that are posted at the top, but all the lines start with kernel. What to do? Woe is me!

    [Reply]

  26. Marius says:

    I have more than 10 years experience in windows and only 2 in Linux, Debian Ubuntu. I have worked in different business environments. I can give you plenty of study cases.

    Windows is a commercial solution. It provides dedicated solutions in order to build, manage, migrate infrastructures in a very user friendly manner. For this, you are expected to pay. It makes sense, you make money using Microsoft products, you shall pay a percent to them.

    How I started using Linux? I wanted to tell to my computer/server to do something more. For example, I wanted to build interactive proxy rules depending on the emails received, logs and message content.
    In this way, I discovered Linux. I tried several distributions without having a clue about this OS or what I was doing. Ubuntu was like a revelation to me and become my best friend who listen, understands and does whatever I want.

    Conclusion:
    Windows is for certain business needs and does a great job when you deal with large infrastructures.
    It is the ship you buy and your are the captain. You want it better and bigger, you pay more.

    Linux is for everything you can imagine.
    It is the ship you build and you are the captain and the sailor in the same time. You want it better and faster, you work more.

    [Reply]

  27. XITIJ says:

    Hi ,i had installed ubuntu 9.10 , initially only onw user was created .
    Then i unlocked the root user account. I accidetely lost the root password.
    I had followed the following procedure.
    1. Reboot the machine.
    2. Press the ESC key while GRUB is loading to enter the menu.
    3. Select ‘recovery mode’ option.
    4. screen will show you Recovery Menu
    resume Resume Normal boot
    clean try to make free space
    dpkg Repair broken packages
    grub Update grub boot loader
    netroot Drop to root shell prompt with networking
    root Drop to root shell prompt
    Now select “root Drop to root shell prompt” presss Enter

    Now you will drop in the root shell
    just type command passwd
    just give your password & retype password .
    This should change the password & to view effect reboot the system.

    [Reply]

  28. skyle says:

    Thanks! Very happy with Linux. I had an ancient IBM NetVista, with only 500K of RAM – couldnt run the new XP or Vista, MS Office, so I deleted the Win box and replaced with Ubuntu. Lightning fast, all the apps I need, and any tech question I ever have takes no more than a google question to find a forum with the answer, in 2 minutes.

    [Reply]

  29. Carl says:

    Does not work.

    [Reply]

  30. Freak says:

    OH MY GOD DAN CALM DOWN!
    this is the internet. not smackdown!
    linux is very dependable! and user friendly! my friend sherri, VERY computer-stupid. i put it on her laptop after windows crashed, and she knew her way around in minutes! now compatibility is something they do need to work on, i admit. my ibook g3 is in my lap i tried to revive with xubuntu and it said basically that it didnt know the computer it was on from a hole in the wall. so its not running. and every disk i try [bootleg AND legit] will NOT boot on it. anybodie have any advice? i was going to swap the hard drive but all i have is sata and i discovered it was ide. any suggestions are HIGHLY APPRECIATED

    [Reply]

Leave a Reply