子目录未使用正确的组创建,即使父目录具有 SGID
Subdirectory not created with proper group even parent has SGID
我有一个 SGID 位打开的文件夹:
lucas@arturito:/home$ ls -l | grep share
drwxrwsr-x 11 share sambashare 4096 May 5 14:54 share
如果我进入共享并在其中创建一个文件夹,该文件夹将包含组 'sambashare'。到目前为止,还不错...
lucas@arturito:/home$ cd share/
lucas@arturito:/home/share$ mkdir test
lucas@arturito:/home/share$ ls -l | grep test
drwxrwsr-x 2 lucas sambashare 4096 May 5 15:07 test
现在,如果我移动到 /home/share/test 下并创建一个新文件夹,该新文件夹将继承该组:SGID 正在工作。
lucas@arturito:/home/share$ cd test
lucas@arturito:/home/share/test$ mkdir test1
lucas@arturito:/home/share/test$ ls -l | grep test1
drwxrwsr-x 2 lucas sambashare 4096 May 5 15:09 test1
但是,在 /home/share 下,除了新创建的 'test',我还有其他文件夹。如果我移动到其中任何一个下,并创建一个新文件夹(比如 'test2'),该新文件夹将忽略 SGID,并且该组将是我的组。
lucas@arturito:/home/share$ ls -l | grep 99
drwxrwxr-x 9 share sambashare 4096 May 5 15:11 99_varios
lucas@arturito:/home/share$ cd 99_varios/
lucas@arturito:/home/share/99_varios$ mkdir test2
lucas@arturito:/home/share/99_varios$ ls -l | grep test2
drwxrwxr-x 2 lucas lucas 4096 May 5 15:11 test2
为什么会这样? /home/share 为 下的任何 其他目录(新的或旧的)设置 g+s 是否足以继承 /home/share 的组?
我迷路了。任何提示或想法将不胜感激!
谢谢!
卢卡斯
新文件夹将继承该位,但现有文件夹需要对其进行明确设置。您可以 运行 下面的命令一次,以递归方式在任何现有子文件夹上设置它。
find /home/share -type d -exec chmod g+s '{}' \;
我有一个 SGID 位打开的文件夹:
lucas@arturito:/home$ ls -l | grep share
drwxrwsr-x 11 share sambashare 4096 May 5 14:54 share
如果我进入共享并在其中创建一个文件夹,该文件夹将包含组 'sambashare'。到目前为止,还不错...
lucas@arturito:/home$ cd share/
lucas@arturito:/home/share$ mkdir test
lucas@arturito:/home/share$ ls -l | grep test
drwxrwsr-x 2 lucas sambashare 4096 May 5 15:07 test
现在,如果我移动到 /home/share/test 下并创建一个新文件夹,该新文件夹将继承该组:SGID 正在工作。
lucas@arturito:/home/share$ cd test
lucas@arturito:/home/share/test$ mkdir test1
lucas@arturito:/home/share/test$ ls -l | grep test1
drwxrwsr-x 2 lucas sambashare 4096 May 5 15:09 test1
但是,在 /home/share 下,除了新创建的 'test',我还有其他文件夹。如果我移动到其中任何一个下,并创建一个新文件夹(比如 'test2'),该新文件夹将忽略 SGID,并且该组将是我的组。
lucas@arturito:/home/share$ ls -l | grep 99
drwxrwxr-x 9 share sambashare 4096 May 5 15:11 99_varios
lucas@arturito:/home/share$ cd 99_varios/
lucas@arturito:/home/share/99_varios$ mkdir test2
lucas@arturito:/home/share/99_varios$ ls -l | grep test2
drwxrwxr-x 2 lucas lucas 4096 May 5 15:11 test2
为什么会这样? /home/share 为 下的任何 其他目录(新的或旧的)设置 g+s 是否足以继承 /home/share 的组?
我迷路了。任何提示或想法将不胜感激!
谢谢!
卢卡斯
新文件夹将继承该位,但现有文件夹需要对其进行明确设置。您可以 运行 下面的命令一次,以递归方式在任何现有子文件夹上设置它。
find /home/share -type d -exec chmod g+s '{}' \;