[HowTo] Recover Root Password In Ubuntu

Some people say you won’t need to use root account anymore in Ubuntu. That’s why Ubuntu doesn’t activate root account for default install. In my opinion they want to make Ubuntu more secure. Since Ubuntu now is user-friendly and not just for developer or other computer geek, end-user or even a newbie can use Ubuntu. But not for me, i need root account, because it’s more convenient for me to configure or and do setting on an Ubuntu machine. Imagine if i don’t use root account to configure an Ubuntu machine, i have to type ‘sudo’ every session to configure the Ubuntu.

But sometimes you forget your root password, maybe you barely use it or your admin is out and you have to replace him as administrator but he/she doesn’t tell you the root password. No what you have to do? Re-install? I wouldn’t do that, because re-install will make more job unless you think it really necessary and you know what you are doing.

You can recover/change your root password if you have the machine in front of your eyes, i mean you own the machine. So if you looking for how to hack someones server from the network, this article is not for you.

How to recover root password in Ubuntu:

  1. You need to reboot your Ubuntu
  2. When you reach GRUB page, press ‘e’ (with quotes), this command is to edit grub
  3. Edit one of your boot command
  4. Add this command to the very end of that boot command: rw init=/bin/bash
  5. Press enter and boot your system, that command will make your Ubuntu to boot with passwordless root shell
  6. Then just change your password with passwd username command. If it is root just type: passswd root
  7. Reboot your system

Now your root password have changed and you can use it. That’s it. Thanks for reading and have a nice day… upss, don’t forget to leave any comment lol. Thanks.

Comments

  1. oceanman says:

    Very kewl thanks, will try it when soon and let you know how it works!

  2. oceanman says:

    Very kewl thanks, will try it when soon and let you know how it works!

  3. mohamedushsma says:

    Thanks for ur guide i will post my feed back after execute your commands.

  4. mohamedushsma says:

    Thanks for ur guide i will post my feed back after execute your commands.

  5. Aatif says:

    it doesnt work

  6. Aatif says:

    it doesnt work

  7. Jam says:

    I have Ubuntu 10.0.4 and when I boot, I never see grub at all. Esc does not change anything. Just boots in normal sequence.

  8. Anonymous says:

    Last time I forgot my password and tried everything i could do but failed, until I found this great tool Password Genius. It works great, and you can google it.

  9. I’ll try it soon. Thanks for the tips

  10. Pouet says:

    You forgot to set foreground text colour. I can't see what I'm typing.

  11. Budirj says:

    this is not cool for Ubuntu. Imagine this, you left your computer in your dorm and went out for party. Someone (roommate?) just did this to your computer with ubuntu. You came back, but you cannot login to your computer anymore because your password has been changed! from security perspective, this is a flaw! True if people have access to your computer physically, there's not much that you can do to your data. But what if someone just want to piss you off and change your password? and again, yes, u can change it back using the same method, but why not prevent it by default!???

    • you can encrypt your important data with truecrypt. and use bios password to lock your BIOS POST.

      • Buddy says:

        i am talking about the built-in OS security the *nix system used to have and has a long history of being secured. Encryption and BIOS password protection? why not lock your computer in your cabinet, too? can you do this kind of password reset to a Mac? with Vista and Windows 7, you will at least need a boot media and toolkit inside. Ubuntu? just a couple of keystrokes? are you kidding me?

        • Reset Windows and Mac OSX also easy if you have the machine in front of you. With couple tools and some skill to reset it. It is designed for disaster recovery. If they can get to your physical machine, they can do everything.

        • budirj says:

          i think that's exactly what i said, if you have physical access to the computer, basically it's zero security. but i think my point is, it is way to easy to root ubuntu system, just a few keystrokes, in the wrong circumstances, people can get you screwed. other OS, at least you need tool. maybe we should not activate root, like you said early in your post, for security reason. is it not so? please enlighten this lowly newbie cheer!

  12. quangcm says:

    nice

  13. jadeemon says:

    its not working in my pc.. i have ubuntu desktop 10.10,,,, when i put passwd and my username and i press enter it show options with many letter like -d for delete…… it also show "usage: passwd [option] [LOGIN]" when i followed the "usage" and press enter again ,,, it shows again the options,,, pls. help me

  14. Jd03875 says:

    Worked fine on Ubuntu 9.10 Server. Had to hold shift key to get grub (grub2) menu.

  15. HarrySufehmi says:

    For 10.04, you need to hold the SHIFT key when the computer start-up. Otherwise the Grub menu won’t show at all.However, the command mentioned above (rw init=/bin/bash) doesn’t work. It went straight to the login prompt.For Ubuntu 10.04 (Lucid), here’s how :

    1. Reboot your computer

    2. Hold shift during boot to start GRUB menu

    3. Highlight your image and press ‘e’ to edit

    4. Find the line starting with linux and append init=/bin/bash at the end of that line

    5. Press ctrl-x to boot.Source:

  16. HarrySufehmi says:

    For 10.04, you need to hold the SHIFT key when the computer start-up. Otherwise the Grub menu won’t show at all. However, the command mentioned above (rw init=/bin/bash) doesn’t work. It went straight to the login prompt. For Ubuntu 10.04 (Lucid), here’s how : 1. Reboot your computer 2. Hold shift during boot to start GRUB menu 3. Highlight your image and press ‘e’ to edit 4. Find the line starting with linux and append init=/bin/bash at the end of that line 5. Press ctrl-x to boot. Source: https://help.ubuntu.com/community/LostPassword

  17. HarrySufehmi says:

    Buddy – When you have access to the PHYSICAL computer itself – ALL computer can be hacked into :)So yeah, there’s a reason why there’s a 24×7 security guards on any good datacenters 😛

  18. HarrySufehmi says:

    Budirj – “this is not cool for Ubuntu” — hey man, I’d advise you not to show off your lack of knowledge about computer security on the Internet, okay? It’d only embarrass for yourself later in the future. 🙂 Fact is, if you have PHYSICAL access to a machine – it’s game over 🙂

  19. HarrySufehmi says:

    Budirj – “this is not cool for Ubuntu” — hey man, I’d advise you not to show off your lack of knowledge about computer security on the Internet, okay? It’d only embarrass for yourself later in the future. 🙂 Fact is, if you have PHYSICAL access to a machine – it’s game over 🙂

    • budirj says:

      @HarrySufehmi OK, just find this after a looong time! HarrySufehmi, i pity you for having a poor reading comprehension skill! read again what posted above, i did say this "true if people have access to your computer physically, there's not much that you can do… bla bla.." oh so you 're the expert, eh? …plz forgive this lowly newbie…bye!

      • HarrySufehmi says:

        @budirj@HarrySufehmi You left out the next statement, pal : "But what if someone just want to piss you off and change your password?"Let's read it again as a whole, shall we ? "this is not cool for Ubuntu. Imagine this, you left your computer in your dorm and went out for party. Someone (roommate?) just did this to your computer with ubuntu. You came back, but you cannot login to your computer anymore because your password has been changed! from security perspective, this is a flaw! True if people have access to your computer physically, there's not much that you can do to your data. But what if someone just want to piss you off and change your password? and again, yes, u can change it back using the same method, but why not prevent it by default!???"Suddenly it's clear that you're complaining about something that you ALREADY know is the truth 🙂 I forgot what's the term for that…. troll ? trolling? 🙂

      • HarrySufehmi says:

        @budirj And for the record, this capability (easily changing root password via PHYSICAL ACCESS to the machine) have helped me in my job (clients forgot the password to their own server, duh) several times. Us (honest sysadmin) is able to do their job easily, while crackers & bad guys are kept away. Thanks Ubuntu.

      • budirj says:

        @HarrySufehmi@budirj first, sir, i have nothing against you or ubuntu community by saying’this is not cool for ubuntu’. i am an out spoken person and enjoy good discussion,i know ubuntu not long ago, in fact im ubuntu user myself. i suggest you read again ivan’s original post ( like i said, your reading comprehension skill is questionable) you will find he is talking about ubuntu desktop, not server, sir. now picture this, in a large office,there are hundreds of ubuntu desktops in its cubicle where other users or workers have physical access to your computer. what if, say, someone from other dept who doesn’t like you and access your desktop and change your password when you are out? it only takes a few keystrokes and reboot, just as easy as that, and you are screwed. compare to windows, for example, you will need a media with tool like Hiren’s bootCD and a hell longer time to do that, and chances of being caught in the act is huge, people will think twice before they screw you. now, tell me, which OS is better protected? with all due respect, sir, i did not troll.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.