What does the sudo command do?

Solution 1:

On the mac, the user you use to log in is by default not the super user (root) account. This is a security feature (Least Privilege) that is by design.

Along with that security model, sudo is a tool that is provided to allow regular (non-root) users to perform root tasks on a case by case basis.

This prevents a whole host of issues, not the least of which is royally screwing up your machine by accident. :)

Solution 2:

Part of the confusion you're running into is the terminology. In OS X, there are 3 main levels of account privilege you'll run into:

root (aka the superuser, System Administrator, or System): this is a specific account (not just a type of account), and is generally all-powerful. For example, root has full access to all files on the system, not matter what their permissions are. It is generally a bad idea to log in as root, so by default the account is disabled (and mostly hidden). This roughly corresponds to what you're probably calling "Administrator".

(Update: in recent versions of macOS, root's power has been restricted to limit the damage from malware that gets root access. System Integrity Protection (SIP) and the read-only system volume protect the OS itself, and Transparency Consent and Control (TCC) restricts access to users' personal info.)

Administrator: this is the type of account you have; it's allowed to make system-wide changes, but usually has to do something special (i.e. click a padlock icon and authenticate) to enable that access. For instance, if you try to copy a file you don't have read access to, the Finder will require you to authenticate before copying the file. The sudo command is another example of this -- it allows administrators to promote themselves temporarily to root.

Standard user: no special privileges, not allowed to mess with (most) system-wide settings or bypass access restrictions.

There's also sort-of a fourth category: managed accounts are standard accounts that have "parental controls" applied to them.

Solution 3:

I don't have a Mac, but i am a Unix user. No you are not the only user, your are running as a normal user, for security reasons. Imagine you downloaded a virused program and run it as administrator, all your system may be damaged. But if you run it as normal user, only your home directory may be infected, not the whole system.

It also prevent you from doing some dangerous tasks by fault(eg. rm -rf /*, this will remove all the files on your HDD, even the system)

You can use super user for your daily use, but this is highly discouraged.