42

What does the letter S mean below? The file in question is a folder.

                                                                enter image description here

I read here that an upper-case S can represent that the setgid bit is active for a binary executable. But this is a folder. Does it still mean that the setgid bit is activated for it? If so, what does that mean?

35

That means that any file dropped into the folder will take on the folder's owning group.

For example: Suppose you have a folder called "shared" which belongs to user "intrpc" and group "users", and you (as user "initrpc") drop a file into it. As a result, the file will be belong to user "intrpc" and group "users", regardless of "initrpc"'s primary group.

On most systems, if a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory.

You can read about it here.

Why is the letter uppercase (from the link you gave)?

setgid has no effect if the group does not have execute permissions. setgid is represented with a lower-case "s" in the output of ls. In cases where it has no effect it is represented with an upper-case "S".

  • Here's a nice explanation of setgid applied to directories. – Matthias Braun Jan 27 '18 at 13:46
  • 2
    I think it's misleading to say setgid has no effect if the group does not have execute permissions because it does have an effect. Just add a file to the directory as the owner of the directory: the file will have the directory's group instead of the owner's primary group. – Matthias Braun Jan 27 '18 at 17:05
12

The upper case S is because the directory does not have execute permissions for the group. In a way this indicates an "error", as you are saying:

newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory.

(source: https://www.gnu.org/software/coreutils/manual/html_node/Directory-Setuid-and-Setgid.html)

However, you are denying permission for the group members to enter the directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.