Command line - How to authorize a folder to a certain user in Linux?
漂亮男人
漂亮男人 2017-06-24 09:42:43
0
4
1570

Under Linux, can a certain folder be authorized to a certain user or a certain group separately? Other users or groups have no permissions on the folder, and the ownership of the folder remains unchanged?
For example,
has the folder test1

The permission is drwxr-xr-x and the owner is A

A wants B to have the same permissions on the folder, and other users do not have the same permissions. The owner of the folder is still A

How to do it from the command line? I'm a noob, thanks for the advice.

漂亮男人
漂亮男人

reply all (4)
世界只因有你
  1. Set the group permissions to be the same as the owner

  2. Add B to A’s group

    漂亮男人

    If you want two users to have the same permissions, you first need to modify the folder permissions chmod 775 test1, and then change the group of B to the group of A or add B to the group of A. The usage is as follows:
    usermod -g group loginname
    Forcibly set the group a user belongs to
    usermod -G groups loginname
    Change a user to group(s)
    usermod -a -G groups loginname
    Add the user to a certain group(s)

      仅有的幸福

      Just use acl.
      It seems to be written like this
      setfacl -m user:B:rwx test1

        ringa_lee

        chown [username] [folder]

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!