36

I downloaded Eclipse, uncompressed it, did a few other things and all sudden I notice this interesting behaviour:

^_^ ~/Downloads > sudo chmod 0000 eclipse/

^_^ ~/Downloads > stat eclipse/
  File: 'eclipse/'
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d  Inode: 529725      Links: 9
Access: (2000/d-----S---)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-11-22 19:54:57.752017352 +1100
Modify: 2012-09-20 18:16:26.000000000 +1000
Change: 2012-11-22 20:07:49.354016510 +1100
 Birth: -

^_^ ~/Downloads > sudo chmod 0755 eclipse/

^_^ ~/Downloads > stat eclipse/
  File: 'eclipse/'
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d  Inode: 529725      Links: 9
Access: (2755/drwxr-sr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-11-22 19:54:57.752017352 +1100
Modify: 2012-09-20 18:16:26.000000000 +1000
Change: 2012-11-22 20:08:19.042016478 +1100
 Birth: -

What does 'S' permission mean to a directory? And why it doesn't let me get rid of it?

Thanks.

62

'S' = The directory's setgid bit is set, but the execute bit isn't set.

's' = The directory's setgid bit is set, and the execute bit is set.

SetGID = When another user creates a file or directory under such a setgid directory, the new file or directory will have its group set as the group of the directory's owner, instead of the group of the user who creates it.

To remove the setGID bit:

chmod g-s eclipse/

Taken from man chmod:

You can set or clear the bits with symbolic modes like u+s and g-s, and you can set (but not clear) the bits with a numeric mode.

link to a similar question: https://unix.stackexchange.com/questions/27250/uppercase-s-in-permissions-of-a-folder

  • 3
    What about if s is in the user-bits for a directory e.g. drwsrwxr-x 2 someuser somegroup 4096 May 18 11:39? It doesn't appear to set the owner for files created in the directory... – SeldomNeedy May 18 '16 at 18:19

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.