Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What is the actual benefit that ubuntu (or debian derivatives) achieve by disabling root user.

Everywhere I read, its says to prevent unintentional damages for inexperienced users. I want to know what exactly. Since sudo can execute all commands (that I know/ use). So in what case root can cause damage whereas sudo can't?

PS: I know how sudo works.

share|improve this question
    
possible duplicate of Why is there no option to login as root? –  Takkat May 11 '12 at 10:51

6 Answers 6

up vote 16 down vote accepted

So in what case root can cause damage whereas sudo can't?

Since you must usually invoke sudo each time you want to do something that requires privileges, the reasoning is that you will "think before you leap", i.e. not just stick sudo in front of something without thinking for a second what the command you're running is going to do.

With su on the other hand, once you're in, you're in. You have carte blanche (an open license) to do anything and everything, and the reasoning is you might forget for a moment that you have those privileges and if you're unlucky, execute something that will seriously affect/damage your system -- if you did not have su privileges, the command wouldn't have done anything serious.

share|improve this answer
1  
The "think before you leap" logic is as naive as thinking users will stop to think when shown a dialog box that says "Do you really want to install TrashTheComputer.Virus: Yes/no?" will reduce malware infection rates. –  Dan Neely May 11 '12 at 14:42
4  
@DanNeely - I don't think so. I type a lot of commands, and most of them don't require sudo, so I don't use it. When I do use it, it gives me a moment of pause. Yes, I'm speaking as a programmer, not an average user, but then again, average users don't use the command line. –  Nathan Long May 11 '12 at 15:20

IMO the major advantages of sudo over su are that sudo has superior logging of what commands were run and sudo gives finer control over what users can do.

su is all or none, but sudo can be configured to allow access to some, but not all commands.

See https://help.ubuntu.com/community/RootSudo for a more complete discussion, including advantages and disadvantages.

share|improve this answer

su -

When logged in as root, any task you start, action you trigger, or random event caused by visiting a certain website, etc. .. will run as super-user.

sudo

When you invoke sudo, as you run a command, only that command will run as super-user.

You will be asked for your password, before the command is executed. So user-interaction by you is also required.

Attempts to invoke sudo can also be logged.

share|improve this answer
2  
Indeed, it asks for the current user's password, which makes it easier to manage the root password. If an account is removed from the system, the root password does not need to be reset. Even better, the root account doesn't even require a password at all, so the root account cannot get compromised through brute forcing it. –  jippie May 11 '12 at 10:54

I think first, we need to look into what su and sudo actually are

su - stands for Substitute User. You use this to switch to a shell as another user using that user's password. Commonly used with root. Does not require a password when executed as root.

sudo - allows a permitted user to execute a specified command as another user. Also commonly used with root. However, this allows you to specifically manage what commands may be executed as another use. (For instance, you could give a user the ability to run an init.d script but nothing else.)

Note, you can always run sudo su or sudo -i and that will give you a root shell. However, no root password means no logging in directly as root... which means no one can break into that user.

EDIT: so maybe this answer your looking for is: not having a root password forces you to use sudo, which in turn naturally aligns you with the sudo philosophy which suggests you to enforce greater control over the actions run as root.

share|improve this answer
    
I wrote this myself.... –  user606723 May 11 '12 at 18:01

It is about user/password management for sysadmins.

If you have multiple users, they should all have separate accounts and should be able to be tracked using those accounts. This means that people can't hide their identity. Also, if you need to revoke a specific users permissions you don't also have to reset the root password for that same user. To give every person in an environment with more than 2 admins the root password makes for a nightmare when one person quits. You must not only change it, but communicate it, etc. All this stuff also has to happen when one of them has a laptop stolen or stuff like that. One account with one password per person makes administration simpler. It is similar to the philosophy behind why each service should have its own account. If one account is compromised, you don't have to reconfigure another dozen services (such as backup tasks) to use a different account.

I also find it personally convenient not to have yet another password to keep track of, lose and have compromised. On RHEL I specifically disable the root account after configuring sudo so I don't have to track it. Once in awhile a user b0rks the sudo file, but that's fixable in single-user mode. (Naturally, it is usually a production machine.)

NOTE: 'sudo bash' will allow you to skip typing sudo for each command...

share|improve this answer
    
I always sudo mc :D –  Rony May 16 '12 at 3:18

Usually, logging in as su is easier when performing administrative tasks. However, there is at least one exception: when file ownership matters. If you need a user to be the owner of a file, then log in as that user and use sudo to donwload or copy files. Simple examples are bookmark and wallpaper files. If a user does not own the file, a Firefox "Restore" bookmarks "From File" will fail. When you set a desktop wallpaper, it may not work unless you own the file. Sometimes you can just set privileges or enable as an executable file, but some settings or programs fail if you are not the owner of a file.

share|improve this answer
    
You log in as root and use Firefox to browse the web? I think this is the reason for disabling the root account. It eliminates the possibility of just logging in as root for daily use. –  adempewolff May 30 '12 at 10:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.