LMLPHP后院

设置共享文件目录

使用设置组 ID(SGID)来实现文件共享,目录中新建文件会以目录属组作为默认组,设置 SGID 使用 chmod 命令和符号 s。

$ mkdir test_dir
$ chgrp shared_group test_dir
$ chmod g+s test_dir
$ umask 002
$ touch test.txt

这样 test.txt 默认组别就是 shared_group。掩码需设置为 002,这样才能保证组内成员拥有读写权限。

2024-04-25 18:59:52 1714042792 0.002605