3

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 :)

0

4 Answers 4

4

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.

5
  • 3
    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, 2012 at 13:19
  • Alvar, see my post as to why the root password doesn't "exist"
    – jackweirdy
    Jun 1, 2012 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, 2012 at 13:21
  • 3
    +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. Jun 1, 2012 at 13:57
  • @MichaelDurrant sorry I was wrong then. Always fun to learn new things! :)
    – Alvar
    Jun 1, 2012 at 14:49
1

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.)

0

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.

3
  • 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, 2012 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, 2012 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, 2012 at 13:27
0

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.

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