2

let's say we have dir1 with mode 755 root root and I want user1 to be able to write to the directory, but I don't want to add him to the root group or change the user or group ownership of the directory. Is there something along the lines of chmod user1+w for only granting additional access to a single user without disturbing ownership or adding the user to another group? ACLs perhaps?

CentOS 6.4 EXT4

  • When I used a Mac, chmod allowed you to add an ACL to a file using `chmod +a 'john deny write' file1` or something like that. Does the FreeBSD chmod allow ACLs and the GNU version not allow it? –  Apr 19 '13 at 21:38

2 Answers2

3

If you have acl support installed (package acl) and mounted the FS with acl support (option acl in /etc/fstab), you can try the following:

setfacl -m "u:user1:rwx" /path/to/dir1/

This should add user1 to the list of users allowed to write to that directory.

More infos with man setfacl and man getfacl.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • Should we run `sudo chmod 700 /path/to/dir/` before hand to remove if there is previously defined user permissions? – alper Aug 10 '22 at 18:05
-1

Yes the answer is ACL. We currently config ACL on a thousand of user web server

Shâu Shắc
  • 356
  • 2
  • 4