Saturday, November 14, 2015

permissions - linux: grant write access to a folder for a single user



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


Answer



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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...