Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I give a directory the setgid bit. Then inside that directory I create another directory, and I want it to also have the setgid bit. I have tried something like umask 6002, but it says "octal number out of range." Is there a way to do this?

share|improve this question
up vote 3 down vote accepted

By default, it does that. The newly created folders in a directory which has SGID will have the same permission and group ownership:

# ls -ld folder/
drwxr-sr-x 10 quanta quanta 4096 Oct 27 21:32 folder/
# mkdir folder/test
# ls -ld folder/test/
drwxr-sr-x 2 root quanta 4096 Oct 27 21:33 folder/test/
share|improve this answer
Ah, I see what happened. This does work when manually creating files, but when using mv to bring in files, the setgid bit is ignored. Is there a way around this? – dvcolgan Oct 27 '11 at 14:47
@dvcolgan: "create" is "mkdir". "mv" is "move into". What are you actually trying to do? – Nils Oct 27 '11 at 20:58

a) Use cp -R instead of mv

b) Use find ./path/ -type d -exec chmod g+rwxs {} \; after mv

share|improve this answer

Your Answer


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.