标签:unix linux macos freebsd setuid
正如标题所说,任何类似Unix的系统都会对目录中的SUID位赋予意义,如果是这样,它意味着什么?
SVTX(保存文本或粘滞)位有一个含义 – 除非您可以写入该文件,否则不能从该目录中删除文件.例如,它用在/ tmp上.
SGID(设置GID)位具有含义 – 在此目录中创建的文件应属于拥有该目录的组(尽管稍后可通过显式调用chown(2)来更改该分配).
SUID位怎么样?
解决方法:
作为Node的回答的后续内容,我将在FreeBSD man页面中发布以下mount(8):
suiddir
A directory on the mounted file system will respond to
the SUID bit being set, by setting the owner of any new
files to be the same as the owner of the directory. New
directories will inherit the bit from their parents.
Execute bits are removed from the file, and it will not
be given to root.
This feature is designed for use on fileservers serving
PC users via ftp, SAMBA, or netatalk. It provides secu-
rity holes for shell users and as such should not be used
on shell machines, especially on home directories. This
option requires the SUIDDIR option in the kernel to work.
Only UFS file systems support this option. See chmod(2)
for more information.
和chmod(2)手册页部分引用了suid位:
4000 (the setuid bit). Executable files with this bit set will
run with effective uid set to the uid of the file owner.
Directories with this bit set will force all files and sub-
directories created in them to be owned by the directory
owner and not by the uid of the creating process, if the
underlying file system supports this feature: see chmod(2)
and the suiddir option to mount(8).
请注意,这是一个安全风险,并且知道在启用它时你正在做什么,在FreeBSD中,但我相信Linux也需要启用特殊的mount标志,并且会改变该目录中文件的行为方式.
标签:unix,linux,macos,freebsd,setuid 来源: https://codeday.me/bug/20190717/1485649.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。