159

I tried to su to root so I could install lights, but I get an authentication error when I try:

user@host:~$ su
Password: 
su: Authentication failure
3
  • 3
    Are you following a guide? In Ubuntu the root account is disabled and you may need sudo instead
    – Braiam
    Apr 11, 2014 at 18:22
  • 8
    Just type -sudo su and than the password for your account. Nov 28, 2015 at 14:21
  • using su as mentioed by bogdan in the above comment worked for me.(I upvoted the comment)
    – ambassallo
    Jan 4, 2021 at 15:32

5 Answers 5

252

The root account is disabled by default in Ubuntu, so there is no root password, that's why su fails with an authentication error.

Use sudo to become root:

sudo -i  
8
  • 5
    thanks. I thoguht this error message is caused by wrong password Feb 8, 2017 at 0:56
  • 2
    in my case, setting the SUID bit solved the issue: sudo chmod +s /bin/su
    – CybeX
    May 8, 2017 at 1:19
  • What is -i and what's the difference with -s? @Seth
    – Shayan
    Jun 18, 2019 at 16:40
  • not working for me. Oct 24, 2019 at 5:39
  • @SarfarajSipai Can you elaborate more on what your situation is? What are you trying to do and why are you trying to do it? Thanks :)
    – Seth
    Oct 24, 2019 at 6:22
23

If su doesn't work, I do this (in bash):

user@host:~$ sudo bash
root@host:~# su
root@host:/home/user# 

Voila! You are now root!

A shortcut for this would be sudo su. In this case given that you are a member of /etc/sudoers with all privileges, then you would only need your user's password.

8
  • 9
    After sudo bash you are already root...
    – edwin
    Apr 11, 2014 at 19:43
  • 8
    @edwin After sudo bash you are running bash as root, but '~' still points to /home/user or wherever your user's home directory is. So you are not quite root. A shortcut for this would be sudo su
    – e.thompsy
    Apr 21, 2014 at 12:59
  • 1
    For all intends and purposes, you are already root... What's happening is that sudo is preserving some environment variables. Instead of sudo bash it's better to just use sudo -i.
    – edwin
    Apr 21, 2014 at 16:50
  • 2
    @edwin In some cases these preserved environment variables matter a lot. So I would argue for most intents and purposes you are absolutely right. However, the OP has asked specifically about su to root. I was assuming they knew why they want to do that and that they have a good reason to do it. So I was adding an alternate path to becoming root to the discussion. And here is yet another way: sudo -i then su. But I would totally agree that in most cases just using sudo should be fine. That is what I usually do. Unless I need root. Then I use su.
    – e.thompsy
    Apr 23, 2014 at 16:31
  • 2
    sudo -i already is enough. Seriously, you just sudo su or sudo -i, this is enough to become root (no need to "su" again)...
    – edwin
    Apr 23, 2014 at 17:00
13

Open root with sudo -s and when it's in this mode type:

passwd

Then, choose password. This password will be for su command.

13

You are getting Authentication failure because you are trying to become root which is disabled by default in all versions of Ubuntu. This can be easily circumvented in two ways:

  1. Enabling the root account. This can be achieved by setting up a password.
  2. Instead of su use sudo -i or better yet, append to any command sudo in the way of:

    sudo apt-get update
    [sudo] password for braiam:
    

I wouldn't recommend enabling root, since it could raise a security concern, for example, if you use any service exposed to the web.

4

Use sudo your_command in place of su.
ie

sudo apt-get install "program to install"

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