30

Why do we use sudo to perform a terminal command as an administrative? Why isn't it admin or something else? Is there a reason for sudo?

12
  • 19
    Read sudo ls as "superuser, do ls" (and not, it's not silly, mnemonics are important for remembering commands) (and no, probably it means "s witch u ser and do, given that su means switch user. But I find the former nicest ;-))
    – Rmano
    May 26, 2014 at 1:54
  • 1
    superuser much better than admin :) thank you for replying.
    – Mohammad
    May 26, 2014 at 1:58
  • 2
    It's that sudo voodoo that you do. :) May 26, 2014 at 8:17
  • 14
    Fun fact: in Italian sudo means (I) sweat. I like to interpret sudo X as sweating for the fear of giving the wrong command and wiping all my data. This helps keeping in mind that you should add sudo in front of commands only when 1) It is necessary 2) You know what you are doing 3) You have carefully wrote and read the command line to avoid typos (especially bad spaces which are hard to catch and can result in really awful unexpected results).
    – Bakuriu
    May 26, 2014 at 13:58
  • 2
    @Rmano su originally meant “super-user”, “substitute user” came later. May 27, 2014 at 15:53

8 Answers 8

32

From Wikipedia:

sudo is a program for Unix-like computer operating systems that allows users to run programs with the security privileges of another user (normally the superuser, or root). Its name is a concatenation of "su" (substitute user) and "do", or take action.

Unlike the su command, users typically supply their own password to sudo rather than the root password. After authentication, and if the /usr/local/etc/sudoers (sometimes found at /etc/sudoers) configuration file permits the user access, then the system will invoke the requested command. The sudoers configuration file enables a huge amount of configurability, including but not limited to: enabling root commands only from the invoking terminal; not requiring a password for certain commands; requiring a password per user or group; requiring re-entry of a password every time or never requiring a password at all for a particular command line. It can also be configured to permit passing arguments or multiple commands, and even supports commands with regular expressions.

Its a temporary one-time command with superuser (administrator) privileges without direct root login.

3
  • 11
    The wiki part is correct. The comment about "Mac is Su" is not correct. Macs have both sudo, and su, just as BSD and Linux do.
    – daviewales
    May 26, 2014 at 6:52
  • @Virusboy Hello, I'm sorry to try in this topic. But I have to know Is it easy to use ubuntu 14.04 with Toshiba M840 i3-3110M. Thank you.
    – Bonn
    May 3, 2015 at 4:11
  • Its easy on any pc
    – Virusboy
    May 3, 2015 at 4:17
22

xkcd: Sandwich

Before sudo, most administrators were logged-in as the root user because it is an easy way to configure your system, as you have all the rights. However, a small mistake, or a wrong internet link and your whole system could be affected or even compromised.

Due to this problem, sudo appeared. The aim was to use administrative privileges only for a short period of time, and only when required. In addition, this would avoid the user logging into another account. This would obviously enhance the system safety.

Under Ubuntu, they choose to enhance the safety of your system. Thus, they decided to follow the ‘sudo’ way. The root user is disabled; there is no need for it and especially no risk that a user logged-in via the X interface with the root user. In addition, they've allowed every command to be launched with sudo for authorized users. The cool thing is that power-users can access the root account.

Drawbacks of sudo :

  • Which commands to you allow via sudo
  • You need to write sudo before every command requiring administrative privilege
  • Every so often you need to re-type the password.

What does sudo mean? Its name is a concatenation of "su" (substitute user) and "do".

Why sudo not admin? I think sudo means admin for a specific time and only when you need it.

People who are coming from windows environment should understand why it is not admin :)

References : Site
Picture : xkcd

2
  • so why isn't it called rodo?
    – JamesRyan
    May 27, 2014 at 14:57
  • 3
    Your “before sudo” paragraph is wrong. There is no difference between su and sudo in this respect, the only difference between the two is which credentials are used. Using sudo rather than su isn't more secure (in fact, it is somewhat less secure); the main benefit of sudo (and the reason Ubuntu chose it) is simplicity for the user (only one password to remember). May 27, 2014 at 15:45
11

From Linux.com, a product of the Linux Foundation:

Sudo stands for either "substitute user do" or "super user do" (depending upon how you want to look at it). What sudo does is incredibly important and crucial to many Linux distributions. Effectively, sudo allows a user to run a program as another user (most often the root user).

[Emphasis mine.] Source

3

superuser do

There's a command, su, for becoming the superuser, so you might say

$ su
# apt-get install somehorror
# exit
$

sudo lets you do that in one swoop, and you don't have to remember to renounce your magic powers.

$ sudo apt-get install somehorror
2
  • 2
    su ("substitute user") allows you to become any user: you can specify a username as an argument. May 26, 2014 at 19:23
  • 1
    Actually, the two are not exactly the same, but are similar in most cases. But sudo mainly just allows you to run a program with super user privileges, but keeps your normal environment the same. su actually make you super user, with super user's environment. May 27, 2014 at 2:30
3

Regarding why it isn't "admin" -- or more indirectly, why su isn't "switchUser" or something like that -- Traditional Unix commands tend to be minimal abbreviations for historical reasons having to do with Unix's origins.

For the most basic reason we need to go back to the same reason it's called Unix in the first place. Much of Unix was inspired by one of the early multiuser multitasking operating systems, MIT's Multics. (Unix gets its name either as "the singular of Multics" or "castrated Multics", depending on who you ask and their mood at the moment.)

Among Multics' other innovations, it introduced the concept of separating the actual file location from the directory information, allowing a single file to have multiple names. ("Links", in Unix terms.) Multics took (overly) full advantage of this; most Multics commands have both ALongNameThatIsImpossibleToType and ASNTOECR (a short name that only experts can remember). Experience showed that the long names really didn't add much user-friendliness since, realistically, at that time all users were or quickly became "experts" and almost nobody ever used the long names. When Unix adopted some of Multics' design, one of their simplifications was to discard the unused long names and keep only the expert-friendly short names.

This also fit well with the Unix philosophy of reducing the operating system and its core command set to their essentials, permitting it to run efficiently on smaller systems. In those days programmers were still conserving every byte and cycle possible. Processors were tremendously slower, terminal speeds were likewise tremendously slower, and memory was tremendously more expensive (and slower, and had tiny caches if any). Keeping system commands down to a minimal length may not have actually saved much (if any) real resources, but it "felt right" for the mindset of the time.

If you really insist upon user-friendly command names, the Unix answer would be "You know how to write a shell script; implement it yourself. If you don't know how to write a shell script, you need to learn how to do so. If you don't like learning and/or coding, you're not going to be happy with Unix and should use something else."

3

Whether "superuser" is what su originally derived from, it is inaccurate since the username you give it doesn't have to be a superuser. Ditto for executing commands as another user using sudo -u.

"Substitute user" is more accurate, but sounds clunky. It makes me think of a substitute teacher.

Therefore I prefer to think of su as simply "switch user" and sudo thus as "switch user & do".

1
  • 1
    always tot it is super user do but substitute user sound more right May 27, 2014 at 11:35
2

From the Sudo website :

"What is Sudo?

Sudo (su "do") allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments."

"Sudo was first conceived and implemented by Bob Coggeshall and Cliff Spencer around 1980 at the Department of Computer Science at SUNY/Buffalo. It ran on a VAX-11/750 running 4.1BSD. An updated version, credited to Phil Betchel, Cliff Spencer, Gretchen Phillips, John LoVerso and Don Gworek, was posted to the net.sources Usenet newsgroup in December of 1985."

That said, while I don't believe there is any proof, I have always strongly believed that the name was a kind of geeky programmer joke. You have the command "su" (super user) "do" but you aren't actually a super user -- turn the "doo" into a "doh" and "sudo" looks/sounds a lot like "pseudo" (fake, sham).

-2

Most folks have given the answer that it's a mashup of "super user do". I like this, but it may be more correct to say that it's a mashup of "substitute user do" because you can choose what user you "do" as with the -u flag.

I also think of it as a play on the word psuedonym because you can pretend to be someone else , either root or any other user using the -u flag.

3
  • 3
    Well, the question was why it is named the way it is, not for backronyms and/or mnemonics, so... [citation needed]
    – derobert
    May 27, 2014 at 16:00
  • Also the default target user doesn't have to be root (though it makes sense for it to be or at least one with uid 0 and it generally is), see the runas_default in sudoers. May 27, 2014 at 20:46
  • @derobert +1 for use of "backronyms" and for keeping the site clean from incorrect answers.
    – three-cups
    May 27, 2014 at 23:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .