更改新文件和文件夹的默认权限

Ali*_*Ali 6 linux permissions chmod chown

每次我在 Linux 中创建一个新文件或文件夹时,它都可以由我自己而不是组来 r/w 访问。我想更改我的系统设置,以便该组可以自动访问每个新文件或文件夹。有吗?

Ale*_*eno 9

从文章:

chmod g+s <directory>  //set gid 
setfacl -d -m g::rwx /<directory>  //set group to rwx default 
setfacl -d -m o::rx /<directory>   //set other
Run Code Online (Sandbox Code Playgroud)

接下来我们可以验证:

getfacl /<directory>
Run Code Online (Sandbox Code Playgroud)

输出:

file: ../<directory>/
owner: <user>
group: media
flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
Run Code Online (Sandbox Code Playgroud)

更多信息:http : //www.linuxquestions.org/questions/linux-desktop-74/applying-default-permissions-for-newly-created-files-within-a-specific-folder-605129/

  • 看起来像复制意大利面答案:https://unix.stackexchange.com/a/1315 (4认同)