Linux – What does S in linux file properties mean

linuxunix

I'm creating directories and changing the permissions of them in perl with the following code:

umask 0000;
mkdir $path, 0770;
chown $userid, $groupid, $path;

Now when I do ls -l on a directory I've just created, they are as follows:

drwxrws---  2 user group 4096 Nov  3 15:34 test1

I notice for the group permissions, there's an s instead of x.
Even if I chmod manually to remove all permissions for the user and group ("chmod g=" and "chmod u=", it's still there:

d-----S---  2 user group 4096 Nov  3 15:36 test2

The internet suggests S means everything in the folder is run as su or something? I don't quite understand what it means but I figure I should understand seeing as these are webroots so if there's a security implication, I ought to be aware of it.

Many thanks for your help!

Best Answer

s means the setgid/setuid bit and the executable bit both are set

S means only the setgid/setuid bit is set

check out man chmod for more information.