著者: Florian Zieboll 日付: CC: dng 題目: Re: [DNG] Question: Why does "mkdir -p" produce unexpected file
permissions and group
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Sat, 25 Jan 2020 13:27:10 +0100
Stefan Krusche <linux@???> wrote:
> I observed this behaviour of "mkdir" under /usr/local/:
>
> $ sudo mkdir -p share/doc/subversion-book-en
> $ ls -l -d share/doc/subversion-book-en
> drwxr-sr-x 2 root staff 4096 Jan 25 13:10 share/doc/subversion-book-en
>
> The same happens in a root shell. I rather expected to get this:
> drwxr-xr-x 2 root root …
>
> Why does group get the 's' bit and becomes 'staff'? Is this normal?
> If yes, where is it documented?
Hallo Stefan,
very probably the parent directory is assigned to the "staff" group and
has this bit set as well: It's called SGID-bit and recursively sets the
group ID according to the directory owner instead of the current user -
see man (1) chmod.