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

后端 未结 4 2087
夕颜
夕颜 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 06:05

    It's ugly, but you can use the setfacl command to achieve exactly what you want.

    On a Solaris machine, I have a file that contains the acls for users and groups. Unfortunately, you have to list all of the users (at least I couldn't find a way to make this work otherwise):

    user::rwx
    user:user_a:rwx
    user:user_b:rwx
    ...
    group::rwx
    mask:rwx
    other:r-x
    default:user:user_a:rwx
    default:user:user_b:rwx
    ....
    default:group::rwx
    default:user::rwx
    default:mask:rwx
    default:other:r-x
    

    Name the file acl.lst and fill in your real user names instead of user_X.

    You can now set those acls on your directory by issuing the following command:

    setfacl -f acl.lst /your/dir/here
    

提交回复
热议问题