I installed a Ubuntu and it only has a user. I can login to the system without login. It doesn't ask me for un/pwd. but when I am in, and I want to run some commands as root (sudo), it ask for password and not allowing me to run it. No password works. How can I find password for this user or root?

  • 1
    When you use sudo you use your own password.
    – Keith
    Commented Oct 21, 2012 at 21:21

2 Answers 2


By default, on Ubuntu, there is no password for the root account. To run a command as root, you must run sudo, which asks for your own password. The Ubuntu installation creates one account with sudo privileges and asks you to enter a password for that account.

If you've forgotten the password, you'll have to change it. First, you need to be able to run a command as root (as a non-privileged user, you'd have to enter the current password to change it). The easiest way to do this if you aren't fluent with the Linux command line is to boot the Ubuntu installation media and select “rescue” rather than “install” at the menu. Alternatively, at the boot menu (you may need to press and hold Shift when your computer is booting, after the BIOS has initialized, to see the boot menu), select the “rescue” option or edit the command line to add init=/bin/bash at the end — see Lost Password in the Ubuntu community documentation for more details (this page may not be very up-to-date).

Once you get a command line as root, run this command to change your password:

passwd joe

(where joe is your user name). Then reboot into your normal system, and don't forget the password this time.


I thought Ubuntu forced you to make up a password for root when you install it but obviously not. Try hitting 'return' instead of entering a password when you sudo and see if that works. If so, then you just haven't set a password for root and 'return' will work for anyone. Not a good thing.

You could log in as root, and type 'passwd' (without the 'o') to create a new password for root.

  • sudo uses your user password, not the root password. and besides, if an account doesn't have a password just hitting enter never actually works, in my experience.
    – strugee
    Commented Jun 22, 2013 at 6:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .