Jessica Ann Helm
Jessica Ann Helm

Reputation: 1

Give a specific user permissions to a specific folder from root

I want to give specific users permissions to specific folders, with different levels of permissions (Read, Write, Execute) in Linux. And to do the same for some groups.

For example I want to give the user: sigmundlucas permissions (Read, Write) for promotional_material

Another example is that I want to give the group: testers permissions (execute) for development_project_data_directory

I need to do all of this from the root account as the folders in question don't allow permission to use chmod when signed into the user

I need to add that multiple groups/users need to access some of the files

Upvotes: 0

Views: 2700

Answers (1)

ti7
ti7

Reputation: 18866

This is normally accomplished with chown and groups!

Make some groups for you users to be members of

Then chown the directory to be :<group>

For example

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

You can calculate the chmod with a website like https://chmod-calculator.com/ if you're not used to the numbers

Gotchas

  • directories need to be executable to be entered
  • users must be able to read all the intermediate paths to somewhere you want them to be able to write

Upvotes: 0

Related Questions