Udi
Udi

Reputation: 133

umask for extra permissions like set group id on directories

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.

Upvotes: 0

Views: 1682

Answers (1)

B.S.
B.S.

Reputation: 26

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 {} \;

Upvotes: 1

Related Questions