9
1
In Linux there are SUID, SGID, and sticky bits for directory permissions.
I am absolutely clear about the sticky and SGID bit on files or folders.
But what happens if I apply SUID bit on a directory?
For example, if I apply a SGID bit on a file, a process that gets started with this file will use the effective group ID of the file's group and not the primary group of the user who is calling the file. Same thing if you apply the SUID bit on a file: it will run with the owner as the effective user.
This changes as soon as you apply the SGID bit on a directory, for example chmod -R 2770 /var/testdir/
. Now all new files and folders what will be created within /var/testdir/
will inherit the same group as /var/testdir/
even if the creator's primary group is different. Also, subdirectories will inherit the SGID bit.
But what happens if you apply the SUID bit on a directory? I did not find any information for that case.
Also, what happens if you apply SGID and SGID bit on the same folder?
2Very nice, this is what I was looking for. In this case I guess Ubuntu has not implemented the set-user-ID bit with the mentioned behaviour for directories. But I will test a little :) Thank you – TheMAn – 2015-12-15T22:55:09.960