Vor*_*Dev 55 root sudo terminology su
“超级用户”一词从何而来?它是“监督用户”的缩写,还是只是一个此类用户在系统中拥有的权力水平的指标?
Dav*_*ill 54
su 可以让一个人成为超级用户,拥有各种奇妙的力量。
从第一版 Unix su 手册页:
11/3/71 SU (I)
NAME su -- become privileged user
SYNOPSIS su password
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
user must pass as an argument a password. If the password
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
SEE ALSO shell
DIAGNOSTICS "Sorry" if password is wrong
BUGS
OWNER dmr, ken
Run Code Online (Sandbox Code Playgroud)
来源minnie.tuhs.org/UnixTree/V5/usr/source/s2/su.c.html
su 在 Unix 系统上用于更改用户,通常用于以 root 用户身份运行命令。
而且……继续阅读
我有另一个“su”的意思的基础震动时刻。我找到了一些旧的 Unix 源代码,其中 su.c 可用。出于好奇,我查看了来源。我发现了什么?
Run Code Online (Sandbox Code Playgroud)/* su -- become super-user */ char password[100]; char pwbuf[100]; int ttybuf[3]; main() { 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') return; *q = '\0'; ttybuf[2] =| 010; stty(0, ttybuf); printf("\n"); q = crypt(password); while(*q++ == *p++); if(*--q == '\0' && *--p == ':') goto ok; goto error; badpw: printf("bad password file\n"); ok: setuid(0); execl("/bin/sh", "-", 0); printf("cannot execute shell\n"); error: printf("sorry\n"); }该 C 文件中的第一个注释是什么?
Run Code Online (Sandbox Code Playgroud)/* su -- become super-user */
su被写入仅更改为系统上的 root 用户。它并非旨在切换到任何其他拥有帐户的用户。“su”的意思是“超级用户”。我需要坐下一会儿。上面的代码来自 Dennis Ritchie 和 Ken Thompson 的 Unix 第五版。如果您了解自己的 Unix 历史,那么直到第六版 Unix 世界才真正开始起飞。因此,可以肯定地说,第五版及之前版本中的大部分(如果不是全部)代码都是由 Dennis 和 Ken 自己编写的。第五版 Unix 于 1975 年发布,因此没有比这更权威的了。
| 归档时间: |
|
| 查看次数: |
6374 次 |
| 最近记录: |