Home > Linux / Unix, Security, Tutorial > How to reset Ubuntu root password

How to reset Ubuntu root password

If your memory or mistyping leaves you without the right password to get into an account on a Linux computer, there’s no need to reformat. You’ll just need to reboot into single user mode to reset it. Here’s how to do it on a typical Ubuntu machine with the GRUB bootloader:

  1. Reboot the machine.
  2. Press the ESC key while GRUB is loading to enter the menu.
  3. If there is a ‘recovery mode’ option, select it and press ‘b’ to boot into single user mode.
  4. Otherwise, the default boot configuration should be selected. Press ‘e’ to edit it.
  5. Highlight the line that begins with ‘kernel’. Press ‘e’ again to edit this line.
  6. At the end of the line, add an additional parameter: ‘single’. Hit return to make the change and press ‘b’ to boot.
Change the admin password

The system should load into single user mode and you’ll be left at the command line automatically logged in as root. Type ‘passwd’ to change the root password or ‘passwd someuser’ to change the password for your “someuser” admin account.


Once your done, give the three finger salute, or enter ‘reboot’ to restart into your machine’s normal configuration.

That’s all there is to it. Now just make sure to write your password down on a post-it and shove it somewhere safe like under your keyboard. 🙂

[ Source: Hackzine.com ]

  1. Lisa
    September 11, 2008 at 8:37 pm

    I have tried this and it still does not work. Is there another option i can try? If not then how can i re-install Ubuntu via an NON admin user account ( I cannot remember my password in order to get into my main user account.) I have reset the password before but i have not used this system in such a long time i cannot remember what i changed it to…

  2. September 12, 2008 at 4:47 pm

    Hi Lisa,

    Why is the option above not work? Could explain the steps that you use.

  3. Alan
    January 6, 2009 at 2:54 am

    At least with 8.10, when you select single user mode (either by adding single to your usual kernel line or using the recovery version in grub) you are forced into a Recovery Menu.

    If you choose “root – Drop to root shell prompt” you are still prompted for the root password and are unable to reset it.

  4. Anthony LaFace
    April 9, 2009 at 5:14 am

    you are brutal, your advice sucks

  5. mjavier2k
    May 13, 2009 at 9:08 am

    goto recovery mode then add “rw init=/bin/bash ” press enter, then press b to boot your system.

    hope this helps.

  6. May 26, 2009 at 6:41 pm

    i can’t understand that….
    and i was try this command to reset my password..
    but i m not successful.
    Plz tell me how to reset my root password on ubuntu.plz plz plz plz

  7. July 18, 2009 at 11:00 pm

    Recovery mode, then drop to command line on Ubuntu worked great for me. thanks for the help!

  8. Jaunty
    October 29, 2009 at 1:28 am

    Excellent! This lead me to right place. I’m using Jaunty.

    My route:
    1. Reboot the machine.
    2. Press the ESC key while GRUB is loading to enter the menu.
    3. Select ‘recovery mode’ option.
    4. Select ‘drop to root shell prompt’.
    5. ‘# nano /etc/passwd’ gives you a list of users
    6. change any users password with ‘# passwd [username]’

  9. January 14, 2010 at 1:59 am

    Adding rw init=/bin/bash to the end of the kernel line in the recovery mode boot option worked for me. (“e” on recovery mode option, then “e” on kernel line to get there)
    Thanks mjavier2k .

  10. joserot
    May 16, 2010 at 2:49 am

    Mjavier2k… thanks. you have the truth…

  11. vimal
    September 15, 2010 at 2:36 am

    for me grub not loading , It shows black screen before loading OS and when i press ESC button ,there is no effect on it, and it directly load OS .
    I need to recover my root password

  12. October 1, 2010 at 10:33 pm

    I use the init=/bin/bash and I get a root shell in fact but no useful commands work! neither passwd nor useradd nor anything. :/

  13. October 19, 2010 at 5:40 am

    thankyou for the gud article. keep writing such
    articles. recently i had to reset my windows xp administrator password and a post on reset windows password at http://blog2wptest.blogspot.com really helped me

  14. January 14, 2011 at 1:53 am

    It’s all about the blacks people….don’t you know that by now?

  15. CDGB
    March 18, 2011 at 7:41 pm

    Wow, the ‘rw init=/bin/bash’ worked for me too. Been a Linux admin for nearly 10 years and never knew that one 🙂

  16. sef5
    June 7, 2011 at 11:53 am

    it work for us too..the whole class is doing this password changing

    rw init=/bin/bash’

  17. kaisha
    June 25, 2011 at 3:40 am

    Worked for me. (Ubuntu running in virtualbox on mac 0s) THANK YOU!!!

  18. jaics
    July 22, 2011 at 1:43 am

    when i used rw init=/bin/bash …there was no user mounted….when i used mount /usr
    it said ther in nothing in /etc/fstab or /etc/mtab…smbody help…iam using ubuntu 11

  19. July 22, 2011 at 8:29 am

    boot with rw init=/bin/bash then reset the root password with “passwd”. Reboot again (w/o the rw… ) then login as root …

  20. Mallappa KTRC
    August 4, 2011 at 10:16 pm

    why Ubuntu 11.04 password didn’t recover

  21. befr33
    August 14, 2011 at 8:22 am

    I used a password with an @ sign in it, and it didn’t seem to like it
    Now I’m trying to reset, I choose Recovery, Drop to shell prompt, and I’m asked for root pw
    Is there a way to get to sinlge user mode? I can’t enter commands by the login prompt
    Grateful for any assistance. This is for Ubuntu 11.04 running in VMware Fusion on a Mac, version

  22. August 18, 2011 at 2:27 pm

    blablabla ro single rw init=/bin/bash –> ctrl + X

    • February 24, 2012 at 6:58 pm

      cn u xplain this brefly by stps..!

  23. Guilherme
    October 15, 2011 at 7:09 am

    thanks tubelawak!

  24. Hof
    January 9, 2012 at 3:32 pm

    After trying this about 5 times I gave up. The procedure does not work, you are STILL prompted for the password. I.e, this advice is a load of crap

  25. OldManRiver
    January 18, 2012 at 7:50 am


    I had the problem with the error of “No sudoers users exist”, so found and followed the howto at:


    with the exception of using “Shift” for accessing grub2, and then edited both my:


    I found I had correctly created the users in the sudoers file, but the permissions were wrong in the passwd file.

    You should see something like:


    For the user you need root access for change the line to:


    and save. Notice the root user has the “0:0” value and all users set to “0:0” will obtain root access.

    I did this, exited the root shell with “exit” then selected “Continue in normal mode”, logged in with the root modified user and prompt came up:


    so knew I had root access and could continue administration of my server box.

    Hope this helps and was clear enough!



  26. Naaveen
    July 26, 2012 at 9:41 pm

    Easiest way to recovery the root password is
    open the terminal with normal login and type sudo passwd root
    it will ask the password for current login after successful login it prompt for new root password

    • August 9, 2013 at 3:57 am

      Thank you so much! I’d tried several of the other suggestions above to no avail. This simple solution is the one that saved me.

      • August 9, 2013 at 5:19 am

        Naaveen :
        Easiest way to recovery the root password is
        open the terminal with normal login and type “sudo passwd root”
        it will ask the password for current login after successful login it prompt for new root password

        No that is the insanity way as, if the person lost the password or it is corrupted, anything they respond with “it will ask the password for current login” will fail, because they would not be looking to reset the password if they already knew it.



  27. iwank
    September 6, 2012 at 12:23 am

    vimal :
    for me grub not loading , It shows black screen before loading OS and when i press ESC button ,there is no effect on it, and it directly load OS .
    I need to recover my root password

    Me too, please help ..

  28. December 11, 2012 at 11:04 am

    I do not know whether it’s just me or if perhaps everyone else experiencing issues with your blog. It appears as if some of the written text on your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them too? This might be a issue with my internet browser because I’ve had this happen before.

    Appreciate it

  29. May 3, 2013 at 3:02 am

    My spouse and I absolutely love your blog and find a lot of your post’s to be exactly what I’m looking for.
    Would you offer guest writers to write content in your case?
    I wouldn’t mind creating a post or elaborating on many of the subjects you write with regards to here. Again, awesome website!

  30. August 4, 2013 at 10:20 pm

    However, it is undoubtedly very important to create a banner
    that actually signifies your motive and campaign in proper
    manner. Our vinyl banners are printed at up to 1440dpi, with
    UV protected inks, finished with moulded, strengthened plastic eyelets, or with pole
    pockets, which ever meets your needs. You should try to promote your stand five or six months
    in advance.

  31. August 10, 2013 at 8:09 pm

    I blog quite often and I truly thank you for your content.
    Your article has truly peaked my interest. I am going to book mark
    your site and keep checking for new details about once a week.
    I opted in for your Feed too.

  32. October 18, 2013 at 4:27 am

    ต่ำกว่า 18 ห้ามคัดลอกลิงค์ น่ะจ้า

    >>>>>>>>>>>>>>>>>>>> เวป มวยไทย 2000ปี ( น้องโจ
    มวยไทย 2000 ปี ) โคตร มวยหู

    085-7377349 รายสัปดาห์ 500 รายเดือน 1500 สายส่วนตัว 2000

    ไม่ประชุมสาย สดๆ ในเวที มีของให้เล่น เน้นมวยรอง

    เครื่องต่อ เครื่อง ไม่ผ่านกล่อง เสียงเร็วกว่าภาพที่เห็น

    .เเจ้งให้ทราบ เนื่องด้วยขณะนี้ พวกมวยหู ก็อป ไร้คุณภาพ ระบาดหนัก จะสมัคร หูครั้งใด เรียกใช้ น้องโจมวยหู นะครับ สนใจ
    โทร 085-7377349 โจมวยหู
    …จะสมัครหู ขอบเวที โทรมาที่ 085-7377349 น้องโจมวยหู ระดับโลก ……085-7377349 ที่เด็ด มวยตู้…………รับรองไม่ผิดหวัง ติดต่อ 085-7377349 น้องโจ มวยหู

  33. November 18, 2013 at 12:38 am

    If some one wants to be updated with latest technologies
    after that he must be visit this site and be up to date every

  34. January 11, 2014 at 2:58 am

    Even the quotes for facebook give a tough competition for their counterparts.
    GPS Tracking device can fit in any device and is available in
    all sizes with which tracking and locating of your belongings has become
    easier and efficient. One of the latest trick to avoid the firewalls in schools
    and offices now a days is very popular known as Translator.

  35. April 10, 2014 at 5:12 am

    I loved as much as you’ll receive carried out right here. The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get got an impatience over that you wish be delivering the following.

    unwell unquestionably come more formerly again as exactly
    the same nearly very often inside case you shield this hike.

  36. September 2, 2014 at 2:44 am

    If you would like to obtain much from this piece of writing then you have to apply such strategies
    to your won blog.

  37. September 18, 2014 at 4:29 am

    Hey there! I realize this is kind of off-topic but I needed to ask.
    Does building a well-established blog like yours
    require a large amount of work? I’m brand new to operating a blog
    however I do write in my diary on a daily basis. I’d like
    to start a blog so I can easily share my personal experience and feelings online.
    Please let me know if you have any suggestions or tips
    for new aspiring bloggers. Thankyou!

  38. December 1, 2015 at 6:33 pm

    Download Madden 16 Coin Glitch and get Unlimited Coins and Cash!

    Download here : Madden 16 Coin Generator

  1. November 9, 2011 at 12:40 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: