# Where did the term “superuser” originate

rootsusudoterminology

Where did the term "superuser" originate? Is it a shortening of "supervisory user", or is it just an indicator of the level of power one such user holds in a system?

### Where did the term "superuser" originate?

su allows one to become the super--user, who has all sorts of marvelous powers.

From the First Edition Unix su man page:

        11/3/71                                                        SU (I)

NAME              su -- become privileged user

DESCRIPTION       su allows one to become the super--user, who has all sorts
of marvelous powers. In order for su to do its magic, the
is correct, su will execute the shell with the UID set to
that of the super--user. To restore normal UID privileges,
type an end--of--file to the super--user shell

FILES

DIAGNOSTICS       "Sorry" if password is wrong

BUGS

OWNER             dmr, ken


su is used on Unix systems to change user, and is commonly used to run commands as the root user.

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    pwbuf[100];
int ttybuf[3];
main()
{
register char *p, *q;
extern fin;

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

ok:
setuid(0);
execl("/bin/sh", "-", 0);
printf("cannot execute shell\n");
error:
printf("sorry\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.