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.

Possible Duplicate:
Why is it bad to run as root?

I am bit confused about the need for sudo when I have a single user account set up on my machine. At install time I tried to call the name of my account 'root' which I was not allowed to do. So I used another name, but I still don't understand why certain actions are blocked and why password verification is needed on updates etc.

I can understand this if there are multiple accounts on a machine and some users are set up without certain access privileges but on a single account what is the need for this? It seems pointless that I can login not as root but perform actions that require root privilege just by entering my password.

If all users can do this, what is the distinction between root access and other users access??? Am I missing something here?

share|improve this question

marked as duplicate by izx, James Henstridge, jokerdino, htorque, John S Gruber Aug 18 '12 at 19:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See this question for the reason askubuntu.com/questions/16178/why-is-it-bad-to-run-as-root?rq=1 –  Anwar Shah Jul 19 '12 at 7:16
    
Please see this question, which should answer yours; su is basically permanent root - once you run it, you no longer need to keep sudo-ing repeatedly. –  izx Jul 19 '12 at 7:17
    
And another one askubuntu.com/questions/124773/… –  Elfy Jul 19 '12 at 7:17

2 Answers 2

up vote 2 down vote accepted

You should think of yourself as not one user, but two:

  1. Doing all your normal day to day usage of the machine
  2. The administrator

As an administrator, you can carry out tasks which could damage data if you made a mistake. Also, if you are running as administrator and you connect to a malicious website that exploits your user account, the attacker could have your root privileges. If you are compromised when you are just running as a normal user, it is harder for an attacker to escalate to root.

So it's really about safety, from accidental or malicious incidents.

General rule - run as least privilege wherever possible

share|improve this answer
    
Excellent answer. 1 more thing: it also prevents random people that walk by to issue system wide corrupting commands (well at least outside the 15 minute time frame of the sudo password ;) ) –  Rinzwind Jul 19 '12 at 7:35

It is the basic Underlying Security Feature of Ubuntu /Linux based system . You can refer the detailed description on this subject from RootSudo community wiki

The SuperUser (Root) can do anything and everything, and thus doing daily work as the SuperUser can be dangerous. You could type a command incorrectly and destroy the system. Ideally, you run as a user that has only the privileges needed for the task at hand.......

....Using sudo avoids the "I can do anything" interactive login by default (e.g. the tendency by users to login as an "Administrator" user in Microsoft Windows systems), you will be prompted for a password before major changes can happen, which should make you think about the consequences of what you are doing.

sudo adds a log entry of the command(s) run (in /var/log/auth.log). If you mess up, you can always go back and see what commands were run. It is also nice for auditing.

share|improve this answer

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