【问题标题】:Give a specific user permissions to a specific folder from root从根目录授予特定用户对特定文件夹的权限
【发布时间】:2021-07-29 22:38:04
【问题描述】:

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

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

另一个例子是我想给组:testers 权限(执行)development_project_data_directory

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

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

【问题讨论】:

    标签: linux permissions subdirectory chmod user-permissions


    【解决方案1】:

    这通常通过chown 和组来完成!

    为您的用户创建一些群组

    然后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

    陷阱

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

    【讨论】:

      猜你喜欢
      • 2014-04-08
      • 1970-01-01
      • 1970-01-01
      • 2018-06-17
      • 2016-07-27
      • 1970-01-01
      • 2011-03-24
      • 2012-03-10
      • 2019-11-15
      相关资源
      最近更新 更多