Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I ls -la, it prints many attributes. Something like this:

-rwSrwSr-- 1 www-data www-data   45 2012-01-04 05:17 README

Shamefully, I have to confess I don't know the exact meaning of each attributes. For example, what's the meaning of big S in the string -rwSrwSr--? What's the following 1? I know others roughly. It will be appreciated if you note them together :)

share|improve this question
    
Eonil: There's nothing shameful about needing to ask a question, after all that's what this site is about. And as for those who say RTFM, many of us DO THAT and still cannot find the simplest answer after wading through pages of hard-to-read programmer-written documentation (and I'm a programmer). In some cases, we're on systems where the man pages were not installed. For all those reasons, and many more, sites like this are a godsend. Thanks for asking the same question I had. –  Alan Aug 10 '12 at 22:10
add comment

2 Answers

up vote 3 down vote accepted

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.

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).

share|improve this answer
add comment

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.

share|improve this answer
    
Basically this is what you get with chmod g-x,g+s dir –  sanmai Mar 13 at 1:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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