Sections

  • About Author
  • Contact
  • Debian Hosting
  • Popular Posts
  • Privacy Policy
  • Sitemap

Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

Categories

  • Backup
  • Database
  • Free-Tools
  • General
  • Monitoring
  • Network
  • Other Linux
  • Package-Mgmt
  • Paloalto Firewalls
  • Security
  • Webserver

Enable and Disable Ubuntu Root Password

Posted on September 28, 2006 by ruchi 90 Comments

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

Related content:

  1. forgot root password or reset root password in Debian
  2. Howto restrict su command to superuser only in Linux
  3. Recover MySQL Database root password
  4. How to Reset debian Root Password
  5. how to change root password in debian

Categories: General, Security

Tags: disable-root-account-ubuntu, enable-root-account-ubuntu, Security, sudo-ubuntu

90 thoughts on “Enable and Disable Ubuntu Root Password”

Newer Comments »
  1. Mohtek on September 29, 2006 at 3:36 am said:

    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 on October 17, 2006 at 10:51 pm said:

    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 on March 2, 2007 at 4:05 am said:

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

  4. slurp812 on March 15, 2007 at 3:16 am said:

    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 on April 10, 2007 at 12:29 pm said:

    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 on July 19, 2007 at 12:53 pm said:

    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 on September 9, 2007 at 11:57 am said:

    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 on September 26, 2007 at 11:05 pm said:

    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 on April 13, 2008 at 3:53 am said:

    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 on April 30, 2008 at 11:10 pm said:

    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 on May 3, 2008 at 5:39 pm said:

    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 on May 4, 2008 at 10:33 pm said:

    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 on May 8, 2008 at 9:03 pm said:

    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 on May 13, 2008 at 12:13 pm said:

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

  15. James on May 25, 2008 at 4:06 am said:

    ‘No โ€œsudo bashโ€, no passwd.’

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

    James

  16. andy on June 6, 2008 at 6:40 pm said:

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

  17. Tim on June 8, 2008 at 8:47 am said:

    @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 on June 21, 2008 at 7:36 am said:

    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 on June 24, 2008 at 4:51 pm said:

    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 on July 1, 2008 at 12:49 pm said:

    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 on July 2, 2008 at 3:12 pm said:

    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 on July 16, 2008 at 3:55 am said:

    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 on July 28, 2008 at 4:09 pm said:

    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 on August 5, 2008 at 10:37 pm said:

    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 on August 8, 2008 at 4:55 pm said:

    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 on August 8, 2008 at 5:00 pm said:

    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 on August 22, 2008 at 6:10 pm said:

    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 on August 23, 2008 at 4:23 pm said:

    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 on September 26, 2008 at 7:34 am said:

    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 on October 9, 2008 at 9:03 pm said:

    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 on October 13, 2008 at 7:48 am said:

    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 on November 24, 2008 at 11:42 am said:

    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 on November 27, 2008 at 11:03 pm said:

    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 on November 29, 2008 at 5:56 am said:

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

  35. Carsten, Denmark on December 2, 2008 at 11:13 am said:

    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 on December 2, 2008 at 3:18 pm said:

    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 on February 17, 2009 at 8:25 am said:

    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 on April 2, 2009 at 2:35 am said:

    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 on June 2, 2009 at 7:17 pm said:

    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 on June 3, 2009 at 2:45 pm said:

    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? ๐Ÿ˜›

  41. fcdenton on June 4, 2009 at 6:46 am said:

    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 on June 4, 2009 at 6:48 am said:

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

  43. Rajendra on July 22, 2009 at 8:40 am said:

    Thank you very much this commands I’m Successfully login root user.

  44. Marina on August 21, 2009 at 8:11 pm said:

    Thanks! ๐Ÿ™‚
    Easy!

    Thank you Therry for showing how to enable root log in…

  45. Kenny on October 5, 2009 at 6:27 am said:

    I’m new to kubuntu 9.04, actually just installed it bout a week ago with dual-boot with my XP. Well I’ve read some of the commands up above, but some other sites says it would be easier to go to “System > Admistrator > Synaptics Manager” to look for programs and install. I must be blind, but I searched high and low, no luck on it. Any suggestions?

  46. Fcdenton on October 5, 2009 at 6:55 pm said:

    You need to install Synaptic. Open terminal and type:
    sudo apt-get install synaptic
    Alternatively, you can use another manager: Applications -> Add/Remove Programs

  47. John on October 23, 2009 at 8:46 am said:

    I have had not many problems with Ubuntu coming from a Windows background, but I have used Linux as well since Debian 3.0 and Redhat 6.2. I have found that using various live CD’s you can use sudo su - to get a root prompt but what if you forget it is root and type that command to delete all your unwanted pics and accidentally type rm -rf /? sudo you are root running that command and not running at a root prompt for the whole session. Just make sure your password is 8+ characters.

  48. tae on October 30, 2009 at 9:20 am said:

    hi you tried to change ubuntu password with VMware and when you try to type the password it does not work please help

  49. bhtexan on November 16, 2009 at 7:19 am said:

    It is interesting to see alot of the same arogance from so called Linux masters that you see from Macophiles. Just because all you nerdy guys created you own little OS with it’s on little quirks does not make you king of the hill. If you really want to have your OS accepted by “Windoz” users ( and of course you really don’t) then you would not make it like a maze to wander through. So take all your snide little comments that only make you feel good and put them some place the rest of us don’t have to deal with. Whether you like it or not, people are used to Windows and don’t care to be techies just to use a computer, or perform a simple task like install Flash so they can watch a video! If you make it difficult, they will go somewhere else. If you are as smart as you think and want to be smarter than MS, create something a user wants, not what a programmer wants. Just look around you, do most people care how their car’s systems operate? Of course not, they just want it to start and get them where they are going without being a pain in the ass!

  50. fcdenton on November 17, 2009 at 4:27 pm said:

    bhtexan This is not a holywar thread. It is just amazing how you paid microsoft trolls manage to **** up any harmless discussion. Where are your eyes? Are you blind? The topic is called “Enable and Disable Ubuntu Root Password”. Where is there any word about M$, for **** sake?

Newer Comments »

Leave a comment

Your email address will not be published. Required fields are marked *

« Remove unnecessary Files in Debian and Ubuntu Using localepurge
Install libdvdcss and w32 video codecs in Debian and ubuntu »

Sponsored Link

    Cheap Web Hosting

Categories

  • Backup
  • Database
  • Free-Tools
  • General
  • Monitoring
  • Network
  • Other Linux
  • Package-Mgmt
  • Paloalto Firewalls
  • Security
  • Webserver

Sponsored Link

Archives

Sponsored Link

Favourite Sites

Ubuntu Geek
  • About Author
  • Contact
  • Debian Hosting
  • Popular Posts
  • Privacy Policy
  • Sitemap