Setting default permissions for newly created files and sub-directories under a directory in Linux?

后端 未结 4 2082
夕颜
夕颜 2020-12-04 05:51

I have a bunch of long-running scripts and applications that are storing output results in a directory shared amongst a few users. I would like a way to make sure that every

4条回答
  •  一生所求
    2020-12-04 05:56

    To get the right ownership, you can set the group setuid bit on the directory with

    chmod g+rwxs dirname
    

    This will ensure that files created in the directory are owned by the group. You should then make sure everyone runs with umask 002 or 007 or something of that nature---this is why Debian and many other linux systems are configured with per-user groups by default.

    I don't know of a way to force the permissions you want if the user's umask is too strong.

提交回复
热议问题