What's the difference between "s" and "S" in ls -la?

The documentation of the ls command answers these questions. On most unix variants, look up the ls man page (man ls or online). On Linux, look up the Info documentation (info ls) or online.

The letter s denotes that the setuid (or setgid, depending on the column) bit is set. When an executable is setuid, it runs as the user who owns the executable file instead of the user who invoked the program. The letter s replaces the letter x. It's possible for a file to be setuid but not executable; this is denoted by S, where the capital S alerts you that this setting is probably wrong because the setuid bit is (almost always) useless if the file is not executable.

When a directory has setuid (or setgid) permissions, any files created in that directory will be owned by the user (or group) matching the owner (or group) of the directory.

The number after the permissions is the hard link count. A hard link is a path to a file (a name, in other words). Most files have a single path, but you can make more with the ln command. (This is different from symbolic links: a symbolic link says “oh, actually, this file is elsewhere, go to <location>”.) Directories have N+2 hard links where N is the number of subdirectories, because they can be accessed from their parent, from themselves (through the . entry), and from each subdirectory (through the .. entry).


According to info coreutils ls (which might not be exactly what you have):

`s'
If the setuid or setgid bit and the corresponding executable bit are both set.

`S'
If the setuid or setgid bit is set but the corresponding executable bit is not set.

The number after the permission part is the number of hard links.


In (hopefully simpler) terms, this means. The directory is setgid. Any files created in there will be owned by that group of the owner of that folder.

However, the folder is not executable by the group, so it's shown in capital S. This is typically when a directory is being created and the directory will end up as setgid.

Hm.. Not sure if that actually sounded like plain English above..

Tags:

Permissions

Ls