≡ Menu

Ubuntu Tips: How To Enable Root User ( Super User ) in Ubuntu

Question: I’m unable to do su – on Ubuntu. It says “su: Authentication failure”. How do I fix it? Also, is it possible for me to login to Ubuntu using root account directly?

Answer: Let us address these two question one by one.

Warning: Enabling root is not recommended. If possible, you should always try to perform all administrative tasks using sudo.

Question 1: I’m unable to login using su command. How to fix this?

By default, root account password is locked in Ubuntu. So, when you do su -, you’ll get Authentication failure error message as shown below.

$ su -
Password:
su: Authentication failure

Enable super user account password on Ubuntu

First, set a password for root user as shown below.

$ sudo passwd root
[sudo] password for ramesh:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Now with the new password you can login as super user with su command

$ su -
Password:
#

Disable super user account password on Ubuntu

Later if you don’t want to use su anymore, you can lock the root user password using one of the methods shown below

$ sudo passwd -l root

( or )

$ sudo usermod -p '!' root

Question 2: How do I login to Ubuntu directly using root account?

First, you should allow the root user to be logged in from the X as explained below.

Step 1: Go to System -> Administration -> Login window.

Step 2: In the Security tab, click on the check box “Allow local system administrator” as shown below. After this change, reboot the system and login directly using root account.

Ubuntu Login Window Preferences - Enable root login
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • C Baltimore September 25, 2009, 4:32 am

    I think you blew this one. Though the analysis of why they couldn’t “su -” directly was right on, the answer is to run “sudo su -” to gain root.

  • Chuck Gregory September 25, 2009, 4:43 am

    Normally you only need root access once in awhile. To execute a single command with root privileges, just use sudo in front of the command, such as:
    sudo gedit somefileyounormallycouldnotaccess

    If you will be doing several commands in a row that need root access, use:
    sudo su

    In either case, you will be asked to enter your password before proceeding. That’s all you need. No need to change root password, just use your own.

  • LaMi September 25, 2009, 6:32 am

    > To execute a single command with root privileges,
    > just use sudo in front of the command, such as:
    > sudo gedit somefileyounormallycouldnotaccess

    And if you need to execute multiple commands simply execute “sudo -s” and enter you own user password. Then you get a root prompt. Nearly the same as using su.

  • counterdutch September 25, 2009, 9:43 am

    it’s saver not to enable root account.
    When you need it do :
    sudo su –

  • Ronald September 26, 2009, 6:23 am

    Any thoughts about ‘sudo bash’ ? I use that quite often actually..

  • Ramesh Natarajan October 5, 2009, 10:18 pm

    @C Baltimore,

    Ofcourse. We have to use sudo to execute any root commands in Ubuntu. I did mention this in the article under “Warning” section. I’ve moved the warning section to the top of the article, to make it visible.

    The purpose of this article is only as a FYI for those who come from other Linux distro (for e.g. Red Hat), where they typically do ‘su – ‘ to gain root. If they still want to continue doing ‘su – ‘ on Ubuntu without doing ‘sudo su -‘, they can use the method mentioned here. (which is still not recommended as I’ve mentioned in the warning section).

  • Pradeep December 11, 2009, 7:35 pm

    Thanks Ramesh, I was stuck in the same issue and it helped me.

  • Nestor April 16, 2010, 1:12 am

    guys, how do I ocnnect to the internet? I replaced my windows XP with Ubuntu 9.10 and now I get a message in the terminal saying oli ‘dip’ group members are allowed to use this command when I use “pon dsl-provider” to connect to the web.

  • Daniel October 5, 2011, 1:46 pm

    Man, you saved my day!

  • Md A Al Baqui October 27, 2011, 7:45 pm

    Hi

    Same problem I got today. Log in screen shows “Authentication failure” after trying to change in “log in window preference”.
    I am new in UBUNTU. I could not follow you as stated above as $ sudo passwd root and others. I want to log in as before. Please help me out.

    Thanks

  • The Janitor January 25, 2012, 12:46 pm

    Ramesh made it clear that it is not good security policy to enable root. If your intent is to add your quacking voice to the cacophony just to hear yourself, bravo! But the user would have discovered how to enable root with or without Ramesh’s help – and, on his own, would likely have not also discovered that there is great risk in doing so.

    Oh, but you’re all the experts. Sometimes the personality of the linux community sickens me; like sharks after one of their own…

    (And save your admonitions for me: I’m betting I’ve been wrangling linux distros longer than most of you have been alive.)

  • Anonymous January 27, 2012, 6:32 am

    hi sir, i want ubuntu more information how to learn in ubtunu ple help me sir

  • Girish January 27, 2012, 5:04 pm

    I installed Ubuntu using VMWare on my Windows XP PC.But I was able to login to my account only once after 3-4 attempts.I get authentication Failure error now.I am new to Linux/Ubuntu;please support.

  • Girish January 27, 2012, 6:19 pm

    Hi got a quick solution from the website.Went to recovery mode after pressing Shift on boot up,dropped to root shell prompt and changed the password for the relevant user.

  • Vijay January 30, 2012, 8:01 pm

    Ramesh
    Thank you very much for the information. it was helpful to know about root account access.
    Regards
    Vijay

  • Dinesh February 8, 2012, 9:45 am

    I have deleted my user account from guest by mistake………
    now i am unable to add user account it is showing Addroot password………
    if i am using above method $ sudo passwd root
    “unable to chande to sudors gid : operation not permitted”
    this error is coming ………..
    please help

  • manoj swami February 13, 2012, 3:49 am

    thnank you very much, i was getting this problem “Authentication failure”,, now its ok by your solution,,,keep it,,

  • rasel ahmed March 21, 2012, 9:17 am

    I’m unable to do su – on Ubuntu. It says “su: Authentication failure”. How do I fix it?

  • sugab March 30, 2012, 10:30 am

    thank you…it does work…

  • Ricardo May 16, 2012, 8:38 am

    Thank you. It works and you save my day.

  • Azaam Basheer June 28, 2012, 8:31 am

    Hi Guys,

    You can use the below command too..

    sudo su

  • moko August 5, 2012, 9:55 am

    hai, ! thanks a lot 🙂

  • V.gnanasekaron October 8, 2012, 9:04 pm

    thank u friends

  • ishwar November 15, 2012, 12:25 am

    Thanks a lot

  • Sara December 14, 2012, 1:49 am

    this really help me..thanks alot:-D

  • krishna kumar sahu January 11, 2013, 7:36 am

    thanks for this

  • Mike February 23, 2013, 11:31 am

    how do you allow root logon from version 12 of ubuntu?

  • Anonymous April 27, 2013, 7:28 am

    Thanks a lot boss

  • Rajendra June 2, 2013, 3:34 am

    Thanks Ramesh. It was helpful.

  • Anonymous July 28, 2013, 11:16 am

    I know this is old as earth however, to disable the account one must use the -L and not -l (capital and not small letter) with the usermod option.

  • Ajinkya September 5, 2013, 10:03 am

    thanks, worked fine. I wanted to install Java runtime on ubuntu. helped me 🙂

  • Anonymous September 13, 2013, 4:22 am

    to allow root login in 12.10 and beyond just install gdm and use gdm instead of lightdm
    ~$ sudo apt-get install gdm after you install gdm you may need to run ~$ sudo dpkg-reconfigure gdm you will first be prompted by a brief introduction where you select you will then be given a choice where you can select on next reboot you can click on “not listed” on the login screen type in root as the user name and then you can use your new password made by following the instructions from Ramesh
    to go back to lightdm you can run sudo dpkg-reconfigure lightdm

  • Gopinath September 19, 2013, 12:33 pm

    your information is useful for me to login as root . Thank you so much

  • Robert October 8, 2013, 7:45 pm

    This problem was very strange, you gave my life back, thanks so much 🙂

  • Sibgha October 27, 2013, 1:03 am

    thanks a lot

  • Dan June 11, 2014, 12:34 am

    Thanks alot buddies

  • dwi June 29, 2014, 5:35 am

    thanks its works.

  • Jeremy August 6, 2014, 6:50 pm

    Thanks.
    I tried to follow your way…
    By the way, regarding the step 1,
    Step 1: Go to System -> Administration -> Login window.
    Where i can find this?
    How can i go to the Login window?
    Thanks.

  • Thierno February 21, 2015, 9:25 am

    thanks man

  • mpho nancy March 30, 2015, 6:22 am

    hi. I am unable to login using su command ,it says authentication failure . How can I fix it ?

  • Victor April 6, 2015, 3:02 am

    Thanks a lot for the tips!
    It really helped

  • alexe July 13, 2015, 10:49 pm

    thank you!

  • Bo Ek November 28, 2015, 3:26 pm

    “You dont need root, you should use sudo”?
    Try running screen as “sudo root” from a user login and then try to list the screens……… The user login owns the X11-process for the your xterm….. It’s not just screen that will fail, there are a bunch of other situations when you get problems.

    Also try installing kvm and guests as a user login. It’s possible but it kind of get a bit anoying when you have to type sudo and password for the 436423594362782349 time……

    Don’t need the root user- Said no linuxadmin ever……..

  • A May 20, 2016, 6:54 pm

    Isn’t sudo kind of a security risk? If su requires a root password, which could (should) be different than the user, wouldn’t that be more secure than using the same user password to gain sudo? If someone compromises your system by getting your user pw, root is only a sudo away.

    sudo su defeats the purpose of having a secure root. sudo is for the LAZY.

    Please tell me how I’m thinking about this wrong. I would honestly like to know.

  • edy January 5, 2017, 10:21 am

    very helpful info, keep it up

  • safa January 22, 2017, 12:06 pm

    hi
    i have Ubuntu 14.04 and i want to install NS2 program
    needs install basic package:
    **sudo apt-get update
    sudo apt-get install build-essential autoconf automake libxmu-dev**
    but this message appear :

    sudo: unable to change to root gid: Operation not permitted

    what i do ??