Image of the glider from the Game of Life by John Conway
Skip to content

The Meaning of 'su'

When I taught for Guru Labs, part of the students training was covering different ways of becoming the root user, such as using "su", "sudo" and taking advantage of the wheel group. Login shells versus non-login shells were also covered. The idea was to help the student understand the real nature of the shell and subshells, not to mention how to appropriately switch user accounts.

Inevitably, I would be asked what the meaning of "su" really stood for. This seems to be the Great Question in Unix (aside from the creat() command in C lacking an 'e'). When I first started with Unix back in 1999, I was always under the impression that "su" meant "super user", as the only time I ever used the command was to become root. My learning was on Solaris 7, and even my colleagues agreed that "su" meant "super user".

After discovering Linux, and having it installed as a virtual machine on my own hardware (yes, VMWare existed back then), I started tinkering, and I found that you could use "su" to switch to more users than just root. This shook the very foundation that I had learned Unix on. So, what does "su" mean? After browsing the man page, and spending a great deal of time on mailing lists and web forums, I was convinced that "su" stood for "switch user" or "substitute user" rather than "super user".

Further, upon learning "sudo", it further cemented that 'su' meant "switch user", as "sudo" meant "switch user and do". After all, "sudo" could be used to switch to any user on the system, not just root. So, as far as I was concerned, "su" meant "switch user" and "sudo" meant "switch user do". Case closed.

Or was it?

A year or two later, I took a Unix interprocess communication course at my local university. Solaris 8 had released, and we were doing our coursework and lab work on those machines. When covering fork() and exec(), my professor taught "su" from the standpoint of it creating a subshell, and showing the parent/child process relationships. This got my mind thinking. Does "su" come from the first two letters in "subshell"? After all, you can "su" to yourself, which means you're not really switching user accounts, and you're not becoming root. I had to know. After class, I asked my professor what "su" meant, and sure enough, he sad "su comes from the first two letters of 'subshell'".

There you have it. "su" means "subshell". So, "sudo" must mean "subshell do" for the same reasons that you can "sudo" to yourself, just as you can with "su". To me, this was the most complete definition of the term. It couldn't get any more complete than that, and when teaching, I taught my students that very thing, usually stating that "su" could mean "super user", "switch user" or "subshell", with my preference and belief on the last definition.

This morning, I had another foundation shaking moment with the meaning of "su". I found some old Unix source code, where su.c was available. Curious, I looked at the source. What did I find?

/* su -- become super-user */

char    password[100];
char    pwbuf[100];
int ttybuf[3];
    register char *p, *q;
    extern fin;

    if(getpw(0, pwbuf))
        goto badpw;
    (&fin)[1] = 0;
    p = pwbuf;
    while(*p != ':')
        if(*p++ == '\0')
            goto badpw;
    if(*++p == ':')
        goto ok;
    gtty(0, ttybuf);
    ttybuf[2] =& ~010;
    stty(0, ttybuf);
    printf("password: ");
    q = password;
    while((*q = getchar()) != '\n')
        if(*q++ == '\0')
    *q = '\0';
    ttybuf[2] =| 010;
    stty(0, ttybuf);
    q = crypt(password);
    while(*q++ == *p++);
    if(*--q == '\0' && *--p == ':')
        goto ok;
    goto error;

    printf("bad password file\n");
    execl("/bin/sh", "-", 0);
    printf("cannot execute shell\n");

What is the first comment in that C file? "/* su -- become super-user */". "su" was written to only change to the root user on the system. It wasn't designed to switch to any other user that has an account. "su" meant "super-user". I need to sit down for a second.

The code above comes from the fifth edition of Unix by Dennis Ritchie and Ken Thompson. If you know your Unix history, it really wasn't until the sixth edition that things really started taking off for the Unix world. So, it's safe to say that most, if not all, of the code in the fifth edition and prior were written by Dennis and Ken themselves. Fifth edition Unix released in 1975, so it doesn't get much more authoritative than that.

"su" can do so much more than Ken and Dennis implemented back then, as already discussed. Surely, the definition of "su" has changed, at least a little? I would hope so. The great thing with human language, is it is dynamic and flexible. We, as a society decide what meanings we put to our words, so as far as we are concerned, "su" could mean so much more than "super user". We can define it to mean "switch user", "substitute user" or "subshell". Or, we can be stubborn, and hold to the old definition from 1975 that "su" means "super user".

So, where does that put us today, 34 years later? Well, I wish I had an answer, but I don't. However, knowing your Unix history (yes, there was Unix before Linux) shows maturity on your part. Knowing that initially "su" was used only for becoming the root user will show others that you are somewhat educated on the topic.

Really, though, the definition doesn't matter all that much, does it? If it means "super user" or "subshell" or anything between, what matters is what you can do with it as a user or administrator. As for me, I like updating the definition to "subshell", but at least I can discuss it at length with another because I know my history.

{ 21 } Comments

  1. Jensen | December 31, 2009 at 8:48 am | Permalink

    OK, I am curious now. Why does the creat() command in C lacks an "e"?

  2. Florob | December 31, 2009 at 9:05 am | Permalink

    Just FWIW, I have also heard su stands for set/switch uid.
    Definitely one of the long standing questions with the most possible answers you discussed there 😉

  3. kragil | December 31, 2009 at 9:08 am | Permalink

    At first I thought it meant "super user", but then I was told it was "switch user" .. are you 100% certain?

  4. Aaron | December 31, 2009 at 10:21 am | Permalink

    @Jensen I have no idea, but Ken Thompson said himself that if he were to rewrite the C programming language, creat() would be create().

    @kragil You didn't read the post, at least not all the way through, did you? You might want to do that before commenting.

  5. Joseph Scott | December 31, 2009 at 11:35 am | Permalink

    The FreeBSD man page - - calls it "su -- substitute user identity".

    The history section at the bottom mentions:

    "A su command appeared in Version 1 AT&T UNIX."

    The man page for V3 - - (dated 1/20/73) says:

    "su -- become privileged user"

    If there was a su command in V1 (which sounds likely) I wonder if it only supported switching to root. Perhaps the more generalized approach didn't come until later.

    There are some other interesting early Unix history bits in this paper - - not directly related to su, but an interesting read.

    Oh! More searching turned up this as well - - the scanned in codes from this -

  6. BUGabundo | December 31, 2009 at 12:45 pm | Permalink

    Thanks for sharing.
    its a fun and nice reading

  7. Garry Parker | December 31, 2009 at 4:02 pm | Permalink

    I'm looking at volume 1 of the "UNIX Programmer's Manual, Revised and Expanded Version", published by Bell Laboratories, copywrite 1983, 1979 and according to this source, su means "substitue user id". Of course the C code you posted above predates that, but I think you might be misinterpreting the comment. The comment is merely saying the "substitute user id" command is used to become the "super-user" AKA root user.

  8. Vadim P. | December 31, 2009 at 5:49 pm | Permalink

    Interesting read.

  9. Aaron | January 1, 2010 at 1:00 am | Permalink

    @Garry Parker I would agree with you, except the code only allows switching to the root user. Switching to any other user wasn't possible like it is now. But again, it really doesn't matter what it stands for, does it? What matters is how you use it.

  10. Garry Parker | January 1, 2010 at 1:16 pm | Permalink

    Aaron, you've got a point there! The more I think about, the more I tend to agree with you. If it was only used to become super-user, it's possible that's what the name originally meant. Perhaps later when more features were added, the definition changed. I've been using Unix since the late 80s and like you I've always heard that su meant super-user.

  11. Capt Caveman | January 2, 2010 at 8:48 pm | Permalink

    Back in the mid 70's when I learning to program my professor said su stood for super user and it that gave you the power to destroy an entire computer system with a single command.

    [WORDPRESS HASHCASH] The poster sent us '0 which is not a hashcash value.

  12. The (C) Gentoo User | March 17, 2010 at 9:58 am | Permalink

    Please fix the code. It does not compile with the latest GCC. Thanks.

  13. jonkx | May 31, 2010 at 10:22 am | Permalink

    I worked with the Unix OS from the early 1980's (at first we ran early versions on a DEC PDP-11) until 1992. Starting in 1992, I did contract work on proprietary versions based on SVR4.

    It was just easier to say the initials "S U" or "super-user" than to say "switch user" or "substitute user". To insist on correctness, whether authoritarian, historical or otherwise seems petty.

    Depending on the options used, su can be used to switch user, substitute user or become "super user". Success depends on knowledge of the appropriate password. "sudo" on the other hand may allow one to become any other user (depending on the configuration of sudo and being a "sodoer") knowing only the login password.

    On the systems I have used, a sudoer can become root ("super user") using this shell command at a terminal:

    sudo su - root

    and responding to the prompt with the login password used to sign in the current user.

    I think it is important to point out that you cannot become "super user" or root from a shell with the su command alone unless there is a root password and that password is entered at the prompt.

  14. Marco | February 24, 2013 at 10:34 pm | Permalink

    I think there's a bug on the code.. to label badpw fallbacks to ok:, so if the getpw doesn't return a correct passwd, setuid(0) will be called >.<

  15. Tri | February 24, 2013 at 11:36 pm | Permalink

    Unix history is always an interesting read!

  16. Jan de Vos | February 25, 2013 at 3:47 am | Permalink

    Surely the wat to start a subshell is by just executing 'sh'? The purpose of su is to make sure you are running as a specific user, so 'Set Uid' would be the most logical interpretation...,

  17. Luffy Ke | February 25, 2013 at 4:02 am | Permalink

    sudo echo 'Interesting reading'

  18. Simon Arthur | February 25, 2013 at 6:51 am | Permalink

    I love how easy it is to overflow the 100 character buffer when entering the password.

  19. Jestin Joy | February 25, 2013 at 7:52 am | Permalink

    For a moment I thought that what I taught all these years to students was wrong. Dennis Ritchie saved my day 🙂

  20. Owain | March 1, 2013 at 1:15 pm | Permalink

    "But again, it really doesn’t matter what it stands for, does it? What matters is how you use it."

    Totally. It could be called 'bananajuice', and it would still function in the same way. Similarly, knowing the origin of sed, grep and tar have little impact on actual usage, despite them now being symbolic of how far computing has developed. (The benefit of brevity with two-letter commands over slow connections is also something consigned to history!)

  21. Kevin Burke | April 12, 2013 at 8:47 am | Permalink

    Brevity is always a good thing.

{ 6 } Trackbacks

  1. [...] The Meaning of ’su’ [...]

  2. Twitted by mehulved | December 31, 2009 at 8:28 pm | Permalink

    [...] This post was Twitted by mehulved [...]

    [WORDPRESS HASHCASH] The comment's server IP ( doesn't match the comment's URL host IP ( and so is spam.

  3. NetStorming » El significado de “su” | January 9, 2010 at 9:40 pm | Permalink

    [...] Al parecer, Aaron Toponce lo ha hecho en muchas oportunidades, llegando al punto de escribir un post sobre el significado de su. En el mismo comenta los distintos descubrimientos que evidenciaban diferentes significados para [...]

    [WORDPRESS HASHCASH] The comment's actual post text did not contain your blog url ( and so is spam.

  4. [...] Shared Aaron Toponce : The Meaning of ’su’. [...]

  5. [...] with my built in console/python terminal, build tools, tabs, and sessions for anything. Noooooo It goes way back to the original Unix code and meanings. Originally SU was SuperUser and not [...]

  6. The Meaning of ‘su’ | شخصی | August 8, 2013 at 8:40 pm | Permalink

    […] The Meaning of ‘su’ […]

Post a Comment

Your email is never published nor shared.