3

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?

2 Answers2

4

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

Rory Alsop
  • 2,789
  • 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 07:35
4

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.

atenz
  • 12,772
  • This reminds me of Windows 95 and 98 where you could just press ESC at the login prompt and you would be into the desktop with no limitations. But not on NT. XP was revolutionary in that it merged both the NT security model with the ability to run older 16-bit programs. – SDsolar Aug 14 '17 at 20:17