Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
su command + authentication failure

i installed ubuntu successfully, but then i tried "su" on terminal and entered my password, authentication failed! and I don't think that i'm root, I don't have root permissions, what should I do ? ... I went to user accounts, it says my account type is Administrator, but that's not root is it ??

thanks :)

share|improve this question

marked as duplicate by James Jun 1 '12 at 14:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

While using Terminal, Just prefix sudoto the command that you want to execute as root. Authenticate it with your user password.....

For example, to install curl, via the root privileges, execute this

sudo apt-get install curl

In ubuntu, the root account does exist, However it is not activated by default. Tough you should avoid this, but if you want to login using the root account, the this is the workout.

sudo -i
sudo passwd root

replace "passwd" with the password of your choice that you want for the "root" account.

share|improve this answer
Alvar: in Ubuntu, by default, if the user is in the "sudo" group, he can run commands as root with su by entering his password, rather than root's. You're right that sudo requires root's password but as explained in other answers, this doesn't work by default on Ubuntu. – roadmr Jun 1 '12 at 13:19
Alvar, see my post as to why the root password doesn't "exist" – jackweirdy Jun 1 '12 at 13:20
Also, enabling the root account is (99% of the time) a very very silly thing to do as it means there's an account on your computer which can do anything. – jackweirdy Jun 1 '12 at 13:21
+1 roadmr, that's the way it works. I recommend deleting Alvar's comment as, no offense, but it is wrong and might mislead a casual reader. – Michael Durrant Jun 1 '12 at 13:57
@MichaelDurrant sorry I was wrong then. Always fun to learn new things! :) – Alvar Jun 1 '12 at 14:49

Why do you need to run as root?

The main difference between Ubuntu (and many other Unix OS') and Windows is that the root account isn't accessible like any other. That is, the password is set to be impossible to enter (Geeks see footnote). If you want to run a program with root privileges, open a terminal and run sudo (program), or gksudo (program) if it's graphical.

The root account is "disabled" for various reasons, all mainly security related.

Footnote: Hashed passwords are stored in /etc/shadow, and the root account password hash begins with a !. Since no possible value can be hashed to begin with a !, there is no possible value which can match the root password. (Alternatively, Linus Torvalds knows all the root passwords.)

share|improve this answer

If you want to "log in as root" (i.e. enter an interactive session as the root user), you can use this:

sudo -i

In Ubuntu, if you're in the "sudo" group, you can even "become" any user on your system:

sudo -i -u whoever

su doesn't work because it requires you to know root's password, which as jackweirdy explains, is not set on Ubuntu. I second his advice about not enabling the root account (it can certainly be done), as it's much more secure to use sudo only when you want to run privileged commands, and use your normal account otherwise.

share|improve this answer
Only problem with sudo -i is you lose your shell history, for example if you sudo -i; foo; bar; you won't be able to press the up key and see what you did when you return to a normal shell, whereas by running sudo foo; sudo bar; you can – jackweirdy Jun 1 '12 at 13:23
hm, if I run sudo -i and then run several commands within the root session, then exit, and sudo -i again, story is all there. This is what I was suggesting. :) – roadmr Jun 1 '12 at 13:25
What I'm saying is if you don't sudo -i you can't see it again. This is a problem when your boss breaks something and you can't see what he did to fix it :( – jackweirdy Jun 1 '12 at 13:27

If you deadly need root privileges and don't want to use sudo prefix, you can enable root account. Simply run

sudo passwd root

from your terminal and give password you want. Then log out, choose "other user", type name - "root", password you gave and log in.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.