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?
By default, on Ubuntu, there is no password for the root account. To run a command as root, you must run
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
Once you get a command line as root, run this command to change your password:
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.