:: Re: [DNG] Question: Why does "mkdir…
Top Page
Delete this message
Reply to this message
Author: Florian Zieboll
Date:  
CC: dng
Subject: 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.

libre Grüße,
Florian

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEELAr/aHjRNwfZVZJo7kVJef5EH9YFAl4sO5sACgkQ7kVJef5E
H9akEw//eac1DBSOSqW4bwgDx+KXrt2NUxLp82HyhSmFeZjp+YV2cZBoJEmQjzRL
OwzzXa9nwWzkYXZ2GM60X7XIPHJcNHSRLOE15tmVGhXHcG47LLXRcZN9++Y6ec5Q
fRQNIHlGLo78xftWTf7BP7jF6iFZCviLQxQl3vncCWKaCKoM4Iqc5Dwjg08fh2+v
/275p7VzELlVc6rOrY1Pg2Q1UQEWn45+ZglrHYiKpHag4UCCV9fZU2P25dXIa9Nz
q/EMErm9oY0tCA90tgBrY3sVdEScC3gMR9Pu6MhHK7azFt7VAaUpSE73gjZMmClS
D2zeufbqean6feSwXB0CBU8HbFXMYoxGXURQBjL/oPgiTo66p2+fvsLw7p4TI0dh
VIply01nzJWvMlN2XQDiFK82tTz5StZAtT0LC8Rh/EVoBzzYjajI9E94bsH3FUii
apur7Bsk5n7a8S2cmHbPo1+6fBtKngStCMUKfhaDC1qRQ/tUvZbTjIkOkGQ+04SL
aZrI3MQsTHQWRn4UdeDY2smwfCbU48gaSu6afDTPQUKYlH4HqoKLa4bBu8VE5Zgh
mPkSB6YOGFtSPMVPG510JL8B/rgNHAg1+d/gVJMXVNvwRBBXoKdRLy5g7mqvYEyr
QnRKsyuMmSdah8e7TGCyJ6OtY3LL+fHIpaR1jOOaUqSLVreZpAQ=
=0/NG
-----END PGP SIGNATURE-----