Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

  • RSS Subscribe

    subscribe to the Debian Admin RSS feed
  • Sponsors



  • Categories

  • Sponsors

  • Support DebianAdmin

    Amount $:
    Website(Optional):


  • Meta

  • Archives



Enable and Disable Ubuntu Root Password

Posted by Admin on September 28th, 2006

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Ubuntu is one of the few Linux distributions out there that will not enable the root account.If you want to do something with root permission on the console you have to type sudo before the command.


sudo” means superuser do. “sudo” will prompt for “Password:”. Please specify user password

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.Because of this your root accout is inactive.

If you want to enable root account (which is not recommended) enter the following command.

$sudo passwd root

This will prompt for a new root password and once you confirm it, you can start using the root account to login.

If you want to disable root account in ubuntu you need to lock the root account by using the following command

$sudo passwd -l root

If you want to work on a root console you’d better use the following command

$sudo -i

  • Share/Save/Bookmark

42 Responses to “Enable and Disable Ubuntu Root Password”

  1. Mohtek Says:

    If you want to get kind of dangerous, you can use
    sudo bash

    This of course allows you to work in the current shell as root.

  2. samuel Says:

    am i the only one that knows that the root account is there, you just have to (#sudo passwd) to give it a password

    anyway id recommend you use sudo unless you are doing heavy admin tasks

  3. ubunt00 Says:

    I don’t mean to start a flame war, but am I the only one who sees this as r00table as h3ll?

  4. slurp812 Says:

    A trick I discovered. I tried su, no dice and ubuntu likes to sudo everything, so I did “sudo du” supplied MY password, and bam, root prompt # w00t!

  5. droetker Says:

    Anyone heard of “sudo -s”? i use that when working longer as admin, just to save the time typing sudo every time.
    No “sudo bash”, no passwd.

    root is safer if it has NO password. BUT make sure, ya know, don’t use “123″ as your user’s password ;-) that would be the same as if root had that…

  6. Larry Says:

    I followed the instructions as printed above, but get a “The system administrator is not allowed to login from this screen” error when booting/login.

    Do I misunderstand this feature?

  7. exasperated Says:

    After a fresh install I want to run apt-get. Have to do it as root. Asks me for root password. No root password as above. So type ‘$sudo passwd root’ Get asked for password. Entering nothing not acceptable. So need password to set password.

    Jesus wept.

  8. Vadim Plessky Says:

    vadim@ubuntu:~$ sudo su
    Password: [enter your user password here]
    root@ubuntu:/home/vadim# passwd root
    Enter new UNIX password:
    Retype new UNIX password:
    ————————————-

    Hope this helps!

  9. SaiHayashi Says:

    Re: exasperated,
    when ur asked for password using sudo, u enter your own user password on whichever user ur logged in with, not the root password.

  10. Schmee Says:

    done everything thats above, got a root password going in the terminal but… going into x-windows, try do anything that requires an administrator password or anything, the root password that i specified in the terminal (and successfully used root there as well) doesnt work.

    any ideas?

  11. j3sus Says:

    every time i write sudo i get ask for a password and then i cant write anyting ,cant only do enter witsh tells me sorry, try again can anyone help me

  12. Thomas Says:

    I’ve wasted more time trying to figure out how to gain admin access to MY OWN DAMN SYSTEM… You can say whatever you want about M$, but at least with XP I have control of my own system. This is just ridiculous. Can’t install anything because I don’t have access to.

  13. thierry Says:

    Once you’ve done the ’sudo passwd root’ stuff to set a password for superuser open the menu System / Administration / Login Window, go to the Security tab and check the box “Allow local system administrator login”.
    And off you go.
    Cheers

  14. vari Says:

    Thanks thierry, it helped me get around the problem, thanks

  15. James Says:

    ‘No “sudo bash”, no passwd.’

    What’s wrong with ’sudo bash’ vs ’sudo -s’, other than 2 characters?

    James

  16. andy Says:

    i tried sudo -sch +zt14 654 / 4, doesn’t seem to work? Any ideas?

  17. Tim Says:

    @Thomas (actually @folks who might read it and get scared, since Thomas is nothing but a bored troll): if you want the “M$” equivalent of admin access on your machine, guess what, you already have it and needn’t read this article in the first place. Sorry. Just type YOUR (normal user) password whenever the GUI asks for one and voila, you’re good to go. This guide is for folks who want to LOG IN as root for whatever strange reasons (i.e. people who know quite a bit about Linux already, obviously not you) and therefore run their *entire session* as root. Yes, that’s also similar to certain “M$” systems ;-) but I’d hardly reccommend it…

  18. bored_shiva Says:

    As much as I hate to say it, I understand where Thomas is coming from. Most of us who have been using computers for a while have forgotten the first time we encountered a GUI, system rights, confusing settings, or any of the hundreds of things that make a newbie feel like, well, a newbie. Most of us got so use to the way Microsoft did things (oh, no, the actual name…) that when faced with a new way of doing things that makes us feel incompetent, we tend to blame the system rather than our own lack of knowledge.

    Thomas (and others): You do have control of your own system. In fact, if all you’ve ever used was Ms. products, it is likely that this is the first time that you have that kind of control. When you are logged-in as a root to your Linux system, you are a GOD, all powerful, capable of great good, and great evil, in a single command. There are very powerful features in Linux that could easily destroy your whole system. And if you are logged in as root, you can do that without as much as a protest. Where as in Windows, even if you were an “administrator” and even if you MEANT to do those things, you couldn’t, because you don’t have true control.
    That’s why logging into root is complicated. That’s why it is unnecessary in 99% of cases. Linux designers in general, and Ubuntu in particular, are well aware of the potential for mayhem. So they do their best to design a system where you can poke around without breaking anything important.

    Sorry for the preachy lecture… :)

    P.S. James: There’s no real difference, except that sudo -s will lunch whatever shell you have defined in the SHELL variable. i.e., not necessarily bash. Arguably this is more dangerous because you could have identical commands execute differently in different shells, but the bottom line is that both options should be used sparingly if at all.

  19. meganox Says:

    There is obviously some confusion around this subject. If you are a normal user who wants to do admin tasks on their Ubuntu system, here is how you do it:

    To do a one-off admin task in the terminal:
    # sudo

    To do several admin tasks in the terminal:
    # sudo -i (runs the shell environment specified for the root account)
    # sudo -s (runs the shell environment for the current user, but with root privileges)

    For all sudo commands, it is YOUR OWN PASSWORD you should give.

    To do an admin task in Gnome:
    Press Alt-F2, or in a terminal, enter: gksudo e.g. gksudo gedit /etc/fstab
    Again, it is your own password you enter. For any GUI application you want to run as root, you should use gksudo not sudo.

    If you have set a root password using # sudo passwd root i suggest you run
    # sudo passwd -l root
    to remove it. A root password is NOT necessary on an Ubuntu system. You should only follow the instructions in this article to enable the root account if you have a good reason to and you understand the consequences. This simply does not apply to most users.

  20. meganox Says:

    Actually, using sudo passwd -l root to disable the root account can interfere with some installation scripts that must use su. You should disable the root account by using a blank password rather than sudo passwd -l root to avoid this.

    To re-enable a root account that has previously been locked like this you should use
    # sudo passwd -u root.

  21. Mac Says:

    I can’t disable root, when I try sudo passwd -l root it just says sorry, and when I use a blank password it says password unchanged

  22. Brad Says:

    Message 19 seems to be most insightful, but still, I like others have very limited access to root. I tried the gksudo into the Nautilus file manager and got hopelessly lost. Coming from a Solaris background, the whole root thing is dangerous, but come on guys….if Ubuntu is only to be used by novices, fine. But occasionally, I need real full root privileges and the whole sudo/gksudo gadget doesn’t work well. I can sysadmin from the command-line all day long and spend a horrendous effort, but since GUI’s have been around for a long while, why I can’t simply and effortlessly enter a root state and use every GUI app as desired leaves me wondering if the Ubuntu authors are all command-line junkies refusing to facilitate the GUI tools available.

  23. Alan Says:

    I’m a newbe user with problems with this.
    I’ve put a new hard drive on. Partitioned it etc.
    Now Ubuntu says I do not have permission to write or copy any files to the disk! It let me reformat it and partition it, but I dont have permition to add a folder. What sort of software is this? Do I need to log in as root or something to access my disk?

  24. troller Says:

    I have to agree with Thomas. I am hardly a newbie to PC’s, having had one since the first 6502 processors appeared. Yet I resent having to jump through hoops to do the simplest thing with this sad, crippled operating system. To all Linux developers – you have to stop being proud of living in 90’s, get off your asses, stop making excuses, and make something that works.

  25. David Says:

    Thanks!!!!!!!!! I enabled root not knowing what I was thinking x.x then was like wait >.> there’s really no need to do that.. so I had to disable it again. I tried to enter a blank password but it just says no password provided, so I have no option to remove the password, I can only use -l

  26. David Says:

    It’s ok Thomas and Troller, I was once a linux dumbass like you too =) in xp you do not have true “administrator” privileges like you do in linux. How about instead of whining for the devs to “get off their asses and make something that works” Why don’t you get off your ass and learn how to work linux, then develop your own distribution that works how you think it should? I used to whine to until I realized it works the way it was programmed, it was programmed for FREE and is open for me to program it better if I get off my ass and learn how, if I do not then I have nothing to whine about.

  27. TJ Says:

    hierry Says:
    May 8th, 2008 at 9:03 pm

    Once you’ve done the ’sudo passwd root’ stuff to set a password for superuser open the menu System / Administration / Login Window, go to the Security tab and check the box “Allow local system administrator login”.

    Tried this but got the following error:

    You might be using a different display manager, such as KDM (KDE Display Manager), CDE login (dtlogin), or xdm. If you wish to use this feature, then your system will need to be configured to use GDM instead.

  28. alex Says:

    hi, i just try’d the commands in the instructions on the top,but its still asking for my root pass…
    anyone have any ideas??

  29. HolyJebus Says:

    To enable the root account on ubuntu (or any gnome-based installation), go to:
    System-> Administration -> Login Window
    Select the “Security” tab
    Make sure “Allow Local System Administrator Login” is checked
    Apply Changes
    Restart

    If there is a solution that does not use the command line, then show new users that solution.
    It’s overzealous Linux nerds showing off their CLI prowess that helps make Linux look scary to newbies by creating the assumption that you have to use the command line to accomplish anything.

    You almost never need to use the command line or edit configuration files.

  30. Mike Says:

    I have to put some agreement behind Thomas and Trollers ideas. The idea behind Linux development came from the idea of free software. Freedom to change, use and distribute software. By putting limitations or restricting access to the root account seems to take away the freedom of choice. I totally agree with protecting the system from serious damage by limiting root access. But again it’s my system I should have the freedom to decide if I want to trash my system or not. It almost likes a form of censorship, telling me what I should use and not use. And yes as someone pointed out I can just reprogram it the way I like and redistribute it out. But I think the point is we should have the choice of using the root account if we want to or not.

  31. supernova_hq Says:

    Mike, the reason for root being restricted is not for the means of censorship. In fact it is a security issue. One of the reasons that Windows viruses are capable of the damage they do is because they are activated by users who run as “Administrator”. If you are logged in as root and end up with a malicious program on your system (yes, they do exist for linux, they just don’t propagate well), then that program is now GOD OF YOUR MACHINE! If you are a regular user, the best that program can do is issue “sudo XXXXX” and try to guess your user password.

    As for restricting what you can do, by default in Ubuntu, when-ever you run a gui administration program, it will either ask you for YOUR password when the program starts, or open a restricted version of the program (basically read-only) with an “unlock” button near the bottom. Whether you enter a password when the program starts, or via the “unlock” button, once you have done so you are now running that program as if you WERE root.

  32. Harry Sales Says:

    Hello There,

    I sort activate the root account by
    $sudo bash
    #passwd
    from then on I can ’su’ as with more conventional systems additionally I create an administrator account that hardy gets used make sure that will sudo and remove myself from the admin group.
    If I want to use an admin facility such as synaptic I do it thus.
    $su
    #synaptic
    or even
    $su
    #gedit /etc/application/application.conf
    to edit a config file

  33. Debunker Says:

    I just wonder how stupid some ppl can be.

    You dont understand that from power comes responsibility?
    You dont understand that you can be less intelligent then someone?
    You dont understand that stupidity can lead to SEVERE results?
    You dont understand what “balanced” development means?
    You dont understand relativity?
    You dont understand that its not-the-whole-world-is-bad-and-hurts,but-you-have-only-broken-a-finger?
    You want all now-and-forever?
    You want “a free operating system” that is also free to everyone on the internet, like a whore(sorry)?
    You want dont want this “sad, crippled operating system”?
    You want to be cool as those models or actors or …(insert name)?
    You’re under 5 years(biologically)?

    Get windoze-> its all that you can handle. Really no problems. Just dont forget to pay and to fix.
    YOU DONT DESERVE THIS ADVANCED AND OPEN SYSTEM, don’t even bother posting here or reading. Please do us all a favour, save a bit of our time, so we can help those who really want to help THEMSELVES.

    For those who ARE interested:
    Just “sit on your own ass” and spend few minutes trying to understand, from the eyes of UNIX system designer, WHY exactly this was implemented that way and not differently. I’m laughing my ass off reading the comments of some “windowze” clowns. Linux is UNIX-family, and UNIX is military class security. Linux is open, true, but it doesn’t mean its open to thieves or bullies. Linux is drunk proof, unlike windows. It is clever, yet you have to find it yourself. Start right from your head.

    If you come from different temple, do not use your own rules here. Do not mix your tea and this tea, empty your cup first. All you need is empty head and will >to inspect< this on your own. If you even do not understand what am I trying to say – don’t bother either, go out and live/die happy.

    If development would be “fun” and “pleasure”, everyone would be god. (Un)fortunately it is not so. Choose your side. You know, happy sheep are needed too…

    Btw thanks to the author of the article, it was informative. At least to me.

  34. Jack Says:

    I can’t do some tasks with this problem. This may be a help.

  35. Carsten, Denmark Says:

    Hi Debunker, and a few others

    I’m new to Linux too, i have had pc’s since the day of DOS 3.something, and now i’m on XP, and that’s how far i’m going in the Windows world, i’m tired of the bigger and bigger demand for bigger hardware to run Windows – and i’m tired of to buggy programs, that also cost a ton of money – so now it’s time for me to change horses ;-)

    On thing i watched growing up on Windows was, the early ver. i could configure and do with it what i wanted, but now it’s Microsoft there’s in control – not me – and i don’t like that either – that’s what i loved about UNIX, when i took the courses, and what i love about Linux as well :)

    And as other newbies, it annoys me when i cannot do a simple operation as unpacking files to the system, it’s no problem installing programs, it works fine for me :)

    I know that UNIX/Linux is probably the strongest system in any way, you can run, but it’s still a new world to us, and takes some time figure out – okay, that depends on how patient one are, i’m not the biggest, so a few hours can seam like looong time ;-)

    But i like the system, i’m hungering to learn how to run it – in every way – so if you know some very good guides, books etc. then let me know :)

    Just one thing on the security issue, i tried logging on IRC as root, i got banned from severel servers, and that’s parobably a good thing, but a funny thing to se as Windows user – but again, as root, and someone hacks my computer, i’m lost – so i think it’s a good thing to protect us against stupidity ;-)

    Well, what i wanted to says is, you, and a few others, seams to know your way around Linux, and also have a certain grounding, calm and relaxed, and give constructed answers – so “hit me” i’m willing to learn ;-)

    Best regards
    Carsten, Denmark

    Since i have had DOS, i’m not afraid of / and know my way around the commandline. I had a couple of UNIX courses aprox 12-12 years ago, and haven’t used it since

  36. Carsten, Denmark Says:

    Hi again

    Admin, kan jo please move the last two lines up, i think after the first or second part of the tekst ?

    Thanks

    Carsten, Denmark

  37. mavdes Says:

    i booted linux from usb

    i have 2 hard disks

    one new the other have problems and i need data from it

    i saw the 2 hard disks but i can copy or see all files coz i dun have permissions

    i used sudo -i and -s and always gives me root@ubuntu:~#

    what i shall do ?

  38. Ed Says:

    My Company uses Check Point Connectra Portal SSL Extender for VPN.
    Its launched via the browser, in my case Firefox, it runs a Java app, then a dialog box prompt comes up and says:

    “The installation script requires root permissions.
    Please provide the root password.
    Password:”

    If I enter my user accounts password it doesn’t work. It fails.
    I don’t have a prompt to tell it to launch via sudo. So I am at a loss.
    My limited IT dept tells me to dump Ubuntu and use a Linux distro that allows root accounts. (I did say they where a limited IT Dept :-) )

    I am a linux and Ubuntu newbie. Would like to keep using this, but if I can’t create and acitviate a root account, even if it is a Pandora’s box of evil, I may have to dump Ubuntu, need to log into work.

  39. Richard Says:

    I have really enjoyed the article and some of the comments. I started in Unix on release 7 which predated the public release of Unix System 5. Never did figure out how you go from release 7 to System 5? I did Unix administration using ROOT logins, but that is the way it was done back in 1979. That was before Bill Gates borrowed his idea for Windoze. I can tell you (from experience) that not having ROOT login permissions is probably a good thing for most users. I had a system that was used for development that had to be disabled when the development contact got cancelled. In “ONE” command, the entire Unix system was totally wiped out. When logged in under ROOT the system assumes you know what you are doing and does NO hand holding. There is no “Are you sure?” windoze warnings, it just goes and does it – no questions, no warnings, no second chances. So if you decide to enable ROOT and login – remember “Let the User beware!”. I am rather new to Ubuntu – but it is nice to see that most of the commands I used all those years ago using command-line still work pretty much like they used to.

  40. MarSys Says:

    I’m new to linux.
    Thought that the user account created on the installation steps was the root.. but no! :(
    Anyway-.. it’s better to lock root instead of leaving it unprotected like on some old linux distributions.
    The default account priviledges are enough to keep and update the system..

    I have doubt… Can someone unlock my root account remotely?
    And since it’s locked there’s no root login for ftp or telnet, right? :P

  41. fcdenton Says:

    I think those users who need root password know nothing about chmod command. If you want to create files on a new partition you should do the following.

    GUI way.
    Login as root and run nautilus, then change the user to yourself and enable permissions to read and write.

    Command-line way (actually, easier but to more experienced).

    sudo nautilus

    OR

    cd /media
    sudo chown -R
    chmod -R ug+rw

  42. fcdenton Says:

    cd /media
    sudo chown -R (user) (partition)
    chmod -R ug+rw (partition)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>