繁体   English   中英

从根目录授予特定用户对特定文件夹的权限

[英]Give a specific user permissions to a specific folder from root

我想授予特定用户对特定文件夹的权限,在 Linux 中具有不同级别的权限(读取、写入、执行)。 并为某些群体做同样的事情。

例如我想给用户: promotional_materialsigmundlucas权限(读、写)

另一个例子是我想给组: testers permissions (execute) for development_project_data_directory

我需要从 root 帐户执行所有这些操作,因为有问题的文件夹在登录用户时不允许使用chmod

我需要添加多个组/用户需要访问一些文件

这通常是通过chown和 groups 来完成的!

为您的用户创建一些组作为其成员

然后将目录chown:<group>

例如

groupadd mygroup                 # create a new group
usermod -aG mygroup myuser       # add the group to the user's info
chown :mygroup target_directory  # set the group to own the directory
chmod 770 target_directory       # root and the group can enter/read/write

如果您不习惯这些数字,您可以使用https://chmod-calculator.com/ 之类的网站计算 chmod

陷阱

  • 目录需要可执行才能输入
  • 用户必须能够读取到您希望他们能够写入的位置的所有中间路径

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM