任何类 Unix 系统是否都赋予目录上的 SUID 位含义?
正如标题所示,任何类 Unix 系统是否都为目录上的 SUID 位赋予了含义?如果是,它意味着什么?
SVTX(保存的文本或粘滞)位有一个含义 - 除非可以写入该文件,否则不得从此目录中删除文件。 例如,它用在 /tmp 上。
SGID(设置 GID)位有一个含义 - 在此目录中创建的文件应属于拥有该目录的组(尽管稍后可以通过显式调用 chown(2) 来更改该分配)。
那么 SUID 位呢?
As the title says, does any Unix-like system ascribe a meaning to the SUID bit on a directory, and if so, what does it mean?
The SVTX (saved text, or sticky) bit has a meaning - thou shalt not delete a file from this directory unless you can write to the file. It is used on /tmp, for example.
The SGID (set GID) bit has a meaning - files created in this directory shall belong to the group that owns the directory (though that assignment can later be changed by an explicit call to chown(2)).
What about the SUID bit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
作为 Node 答案的后续内容,我将从 FreeBSD 手册页中的 mount(8) 中发布以下内容:
以及引用 suid 位的 chmod(2) 手册页部分:
请注意,这是一个安全风险,并了解当你在 FreeBSD 中启用它时你在做什么,但我相信 Linux 也需要启用特殊的挂载标志,并且会改变该目录中文件的行为方式。
As a followup on Node's answer, I will post the following from the FreeBSD man page for mount(8):
And the chmod(2) man page section that refers to the suid bit:
Please be aware that this is a security risk and know what you are doing when you enable it, in FreeBSD but I believe Linux as well it requires special mount flag to be enabled and will change the way files in that directory behave.
从此处复制:
Copied from here:
当在目录上设置时,在此目录中创建的所有文件和目录都将具有与 SUID 目录本身相同的所有者,无论文件是谁创建的。 这是一个不经常使用的功能,但在某些情况下很有用。 (源)
更新:我刚刚在 Linux 2.6.25.5-1.1- 上尝试过此操作默认 #1 SMP x86_64 GNU/Linux openSUSE 11.0 (X86-64)。
但没有效果。
When set on a directory, all the files and directories created within this directory will have the same owner as the SUID-directory itself, no matter who created the file. This is a feature which is not used too often, but it can be useful in some cases. (source)
Update: I just tried this on Linux 2.6.25.5-1.1-default #1 SMP x86_64 GNU/Linux openSUSE 11.0 (X86-64).
It had no effect.
SUID 位指出,在执行文件时(当可执行时),进程将以该文件所有者的身份运行,而不是以执行该文件的用户的身份运行。
在某些情况下,实用程序是“suid root”以允许权限升级。
编辑:误读原始问题(指的是目录而不是文件)-出于教育目的保留答案不变;-)
The SUID bit states that, on execution of a file (when executable), the process will run under the identity of the owner of said file, not the user that executed it.
There are a few cases where a utility program is 'suid root' to allow privilege escalation.
EDIT: Misread original question (which refers to directories rather than files) - leaving answer unaltered for educational purposes ;-)