Question

How can I set the umask to make new directories with set-group-id flag as defaulte?

(I use bash on CentOs6)

I try: umask 5022

bash: umask: 5022: octal number out of range

Or: umask 05022

bash: umask: 05022: octal number out of range

Or: umask u=rwx,g=srx,o=rx

bash: umask: `s': invalid symbolic mode character

The last option is bad because we want the setgid only for directories.

Was it helpful?

Solution

I don't believe you can.

However, once set, the bits are not normally cleared except by another invocation of chmod.

And once set, newly created directories inherit those bits.

Once set, one still has to go through all current directories and set the flag - it's only newly created ones that will auto-inherit.

So, find . -type d -exec chmod g+s {} \;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top