"S" mode for file permission?

Jose I Diaz Bardales jose.dbardales at gmail.com
Sat Dec 12 20:30:59 UTC 2020



On 12/12/20 12:41 PM, Gary Aitken wrote:
> I'm having to fix some permissions in some ruby file hierarchies, and
> came across one with a 'S' for group (note, not 's').  man chmod doesn't
> mention 'S', although it does mention 'X'.  Can someone tell me what 'S'
> represents, and why an attempt to chmod g+s results in a 'S'?  Also, why
> it would be set that way for a particular directory when all others above
> it have 's'?
> 
> .../rvm/gems/ruby-2.6.6/extensions$ ls -l
> drwxrwSr-x 3 rubes rubes 4096 Dec  2 05:20 x86_64-linux
> 
> .../rvm/gems/ruby-2.6.6/extensions$ sudo chmod g+s  x86_64-linux/
> .../rvm/gems/ruby-2.6.6/extensions$ ls -l
> drwxrwSr-x 3 rubes rubes 4096 Dec  2 05:20 x86_64-linux
> 
> .../rvm/gems/ruby-2.6.6/extensions$ sudo chmod g-S  x86_64-linux/
> chmod: invalid mode: ‘g-S’
> 
> .../rvm/gems/ruby-2.6.6/extensions$ sudo chmod g-s  x86_64-linux/
> .../rvm/gems/ruby-2.6.6/extensions$ ls -l
> drwxrw-r-x 3 rubes rubes 4096 Dec  2 05:20 x86_64-linux
> 
> .../rvm/gems/ruby-2.6.6/extensions$ sudo chmod g+s  x86_64-linux/
> .../rvm/gems/ruby-2.6.6/extensions$ ls -l
> drwxrwSr-x 3 rubes rubes 4096 Dec  2 05:20 x86_64-linux
> 
> Thanks,
> 
> Gary
> 

If I remember correctly s is to set the group id on a file or directory 
in other words the file can executed on behalf of the group.

The "s" is for directories and "S" for files.






More information about the ubuntu-users mailing list