Ubuntu: How to enable the root account
Ubuntu is one of the few Linux distributions out there that will not enable the root account (actually it is the only one I have seen myself, but hey, there might be others that I am not aware of). This is a very good idea and you should probably try to learn to use sudo for daily maintenance. But in case you want to enable root login on your Ubuntu system this little post will show you how you can do that.
As you have noticed during the Ubuntu installation there was no question about the root password, as you might have been used to see during other Linux distribution installation process. This is why the root account is inactive and can’t be used (no password configured) until we will setup a proper password for it. To do this, we simply need to run:
sudo passwd rootThis will ask for a new root password and once you confirm it, you can start using the root account to login.
In case you will want to disable back the root account, just lock the root account by running:
sudo passwd -l rootAre you aware of any other Linux distribution that doesn’t enable the root account at installation time? I am just curious because I believe that this is a great idea… but I haven’t seen it implemented in other distributions.
>
12th November 2006, 10:46
Be aware of locking the root account if you once activated it. I activated the root account and skipped the %admin ALL=(ALL) ALL line int /etc/sudoers file because i thought i wouldn’t need it anymore. Then i disabled the root account without thinking and now had no chance to start programs with root rights. Luckily i could restore it using a knoppix live cd. Be aware of changing settings concerning the root account.
31st December 2006, 20:50
Another system is Mac OS 10 (not really linux but based on bsd). It uses the root account mostly to install software – unless you want to do some command line sudos.
Same trick works there too:
sudo passwd root
7th January 2007, 15:54
If I need to perform a lot of maintenance as root, I simply use “sudo su -” to launch a root shell. I do also set a root password, just in case the /usr partition gets corrupted (so sudo won’t work!)
28th February 2007, 15:07
God Bless Open Source
31st August 2007, 20:36
Very nice post, thanks. The info is really useful.
26th January 2008, 10:45
This is a very old feature of ‘Debian Linux’. As ‘Ubuntu’ is based on it, it uses the same feature. It is actually a very good feature if you want to just set the system as a linux box & not have anyone play with it. Use it as it is for some basic purposes. Prevents you from harming the system. You can still do all your software installations but with the assurance of not messing up the system.
27th May 2008, 04:31
[...] Christof Baumann mentions in this post as to why you shouldn’t fiddle with the root account: Be aware of locking the root [...]
20th September 2008, 07:32
can i login using the root account at the first login window by entering the root password?
27th March 2009, 09:40
After setting the root password enable the root login. Click on System> Administration> Login Window. Click on Security tab. Check “Allow local administrator login“
27th March 2009, 15:06
thanks
20th April 2009, 10:14
Fedora 10 also did not have a root login
14th June 2009, 20:01
“This is a very good idea and you should probably try to learn to use sudo for daily maintenance”.
Hey man, this is a **** nonsense! Ubuntu is abusing sudo for something that’s far away from it’s purpose. They are throwing away most of the UNIX security for the sake of “user-friendliness” – reminds me Windows very clearly.
Anyway, thank you for the information, i needed it once when I was setting an Ubuntu box and this came very handy as using sudo to gain root privileges is an incredible stupidity (if it’s not properly set, but in Ubuntu it is not).
29th July 2009, 11:19
I agree with Tadeas: actually I do not understand sudo… If the “%admin ALL=(ALL) ALL line” is present in the /etc/sudoers file (as in the default configuration), you can do everithing as root WITHOUT being root. This really seems a nonsense to me…
6th August 2009, 10:00
I think Tadeas is a whiny little bitch.
why are you using ubuntu if you are so damn smart and think sudo is a waste of time? go use some other OS jackass
13th August 2009, 03:46
What a useless comment. Maybe you haven’t used computers long enough to learn that there’s A FRIGGIN’ LOT of stuff that you can’t do unless you’re root. And, I mean real root. Like fixing stupid nVidia drivers and other things. This whole “UAC-wannabe” stuff is a sham.
14th September 2009, 21:19
My, that thread deteriorated, didn’t it?
Personally, I think the Ubuntu insistence on sudo is both overkill, and overly pedantic. But, they have one of the best, if not the best, installs in the Linux market today, so . . . I live with it.
26th September 2009, 02:51
Yikes! That whole “sudo” thing is what kept me from ever really using Debian/Ubuntu. On any system I admister I have root access and a normal user account. No other users have the root pasword; they don’t need it. They also don’t need “sudo”, ’cause I’m not giving them the chance to screw stuff up with a root-enabled(’cause that’s what “sudo” does) account.
I’ve never trashed a computer as root…I reinstalled a few times when I was learnng Linux because I didn’t know how to fix my mistakes…never anything critical, just didn’t know how to make stuff work, so the easy path(learned from years of using MSWindows) was to reinstall and try again. I got over it.
The reason I bothered to comment is this: I don’t understand the condescension, and even outright hostility, of some people on Ubuntu forums, towards people asking about having a functional root account. Please enlighten me, if you will.
29th September 2009, 22:43
I agree with you about the Ubuntu forums skippy steve, and it puzzle’s me also. Please don’t let this stop you from trying Debian though, as the author mentioned, Ubuntu is the only distro that forces you to use “sudo” in place of “su” by default. Debian itself most certainly does not.
@ Viraj Gadkari Sudo is just a Linux/Unix admin tool, and it has nothing to do with Debian why it is used in Ubuntu, and it certainly doesn’t have anything to do with the way it is used. Sudo is supposed to be used by the administrator, to allow a user(s) to run a specific command(s) as superuser (root), or as another user. It’s not supposed to be used instead of a root account.
30th September 2009, 02:59
“Debian itself most certainly does not.”– Oh, sorry, my misunderstanding. It’s been a long time since I messed w/Debian ;^)
And thanks for clearing up the correct/intended way to use sudo- that actually makes sense(allowing a user to use it for a specific task); I can see its usefulness for some cases in that context.
5th March 2010, 09:34
Ok… Maybe I’m just confused.
1) you can disable sudo as is posted
sudo protects the computer, because a hacker can’t just log in as root and have full privleges, instead they have to log in as a regular user (guessing the username) and THEN run sudo, most likely having to put the password in twice (which really doesn’t decrease it that much…)
In any case, I have no idea why anyone thinks it’s more of a security risk… Someone mentioned multi-user computers. If you make an “administrator” just make sure other users aren’t in the admin group. And it actually defaults to NOT put them in any group, so you’re fine.
Anyway, I want to rsync data as root, so I need a root login…