Linux 文件权限

3 linux file-permissions

我在 Linux 系统上拥有一个特定的文件。我想给 2 个组(会计、运输)读访问权限和只读访问权限,以及 3 个用户(Mike、Raj 和 Wally)写访问权限和只写访问权限。

我怎样才能做到这一点?

Bor*_*lid 7

我建议使用 POSIX ACL(访问控制列表)。您的文件系统必须支持它们/启用 acl 选项,但如果支持,那么您的问题将简化为:

setfacl -m u:mike:w myfile
setfacl -m u:raj:w myfile
setfacl -m u:wally:w myfile
setfacl -m g:accounting:r myfile
setfacl -m g:shipping:r myfile
Run Code Online (Sandbox Code Playgroud)

您可以针对任意权限集执行此操作。