質問

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.

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top