Chr*_*s S 18

来自man chmod

2000    (the setgid bit).  Executable files with this bit set will
        run with effective gid set to the gid of the file owner.
Run Code Online (Sandbox Code Playgroud)

  • 在某些操作系统上,setgid 位会导致在目录中创建的文件将文件 gid 设置为与目录相同的 gid,而不是进程的 gid。此外, 27 **7** 5 意味着它对组的所有成员都是可写的,而不仅仅是目录的所有者。 (8认同)

Tad*_*dej 6

775 前面的 2 是setgid或“组 ID”。

什么是setgid(设置组ID)位用于?

setgid 会影响文件和目录。

  1. 当 setgid 权限应用于目录时,在该目录中创建的文件属于该目录所属的组。任何在目录中具有写入和执行权限的用户都可以在那里创建文件。但是,该文件属于拥有该目录的组,而不属于用户的组所有权。该目录中的文件将与父目录的组具有相同的组。

  2. 当在文件上使用时,它以拥有它的用户组的权限执行,而不是以执行它的用户组的权限执行。

资料来源:

https://www.geeksforgeeks.org/setuid-setgid-and-sticky-bits-in-linux-file-permissions/ https://docs.oracle.com/cd/E19683-01/816-4883/secfile- 69/index.html

有关组 ID 的更多信息:

登录时,密码文件 ( /etc/passwd) 会查找您的登录用户 ID,并确定您的数字用户 ID 和一个初始组用户 ID。组文件 ( /etc/group) 然后为您分配其他组 ID(如果有)。然后系统会启动一个 shell,它作为您唯一的数字用户 ID 运行,并且还拥有您所有数字组 ID(一个或多个)的权限。

资料来源:http : //teaching.idallen.com/cst8207/13w/notes/500_permissions.html#users-one-user-id-and-multiple-group-ids

如何将组 ID 设置为目录:

chmod 2775 /var/www
Run Code Online (Sandbox Code Playgroud)

2前面775的原因是谁在/ var / WWW的所有者组被复制到该目录中创建所有新的文件/文件夹。

还有其他选项然后2:

0: setuid, setgid, sticky bits are unset
1: sticky bit is in place
2: setgid bit is in place
3: setgid and sticky bits are in place
4: setuid bit is in place
5: setuid and sticky bits are in place
6: setuid and setgid bits are on
7: setuid, setgid, sticky bits are activated
Run Code Online (Sandbox Code Playgroud)

来源:http : //www.dba-oracle.com/t_linux_setuid_setgid_skicky_bit.htm

可以在 /etc/group 文件中检查组 ID 中的组名:

group_name:password:GROUP_ID
Run Code Online (Sandbox Code Playgroud)

更多关于组密码:https : //unix.stackexchange.com/a/46518/205850