3

I created a directory in my home directory. and I set its permission as follows:

uhmwk.1.4$ chmod 655 dog
uhmwk.1.4$ ls -l
total 4
drw-r-sr-x 2 s9 s9 4096 Feb 14 21:57 dog

why is the group permission "r-s" when I set it to read and execute and it should be "r-x"?

Please help

6

It means that directory setgid is set and the execute bit is set too. This basically means that files created by other users in this directory will have the group of the directory owner.

Man page says that...

chmod preserves a directory's set-user-ID and set-group-ID bits unless you explicitly specify otherwise. 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.

So... If these directory mode bits have been set in the past they will remain there until you explicitily remove them.

2

The short answer:

    chmod g-s <file or directory name>
  • 3
    And the long answer is? Oneline answer do not count as good one. – Romeo Ninov Jul 24 '17 at 19:17

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.