Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I run Apache 2.2.15 on CentOS 6.4

When a web local run a function and it created files/folders owned by user "apache".

I can read these files/folders via samba but i can't write/delete them.

I've tried using chmod, but it only works for that case, when this web local run again, i can't do anything with these files.

My question is : How can i change permission for user "apache" that all users can access, write, detele.. files/folder that owned by "apache" ?

share|improve this question

1 Answer 1

Filesystem ACLs are going to be your best solution here.

You can set a default ACL on directories, and when a file is created in that directory, it inherits the default ACL. You can then set this default ACL to allow access to the files.

For example, if you wanted to grant all users of the group mygroup read/write access to /var/www, you can do:

setfacl -R -m group:mygroup:rw /var/www
setfacl -R -d -m group:mygroup:rw /var/www

The first line sets the ACL on all the existing files. The second line sets the default for any new files.

And while I think it's a bad idea, if you really want to allow all users full access to the files:

setfacl -R -m other::rw /var/www
setfacl -R -d -m other::rw /var/www

Note that this will require your filesystem to be mounted with ACL support. If this is not currently the case, you can do so via mount -o remount,acl /var/www (or whatever the mountpoint is). Then edit your /etc/fstab and add the acl option to the appropriate line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.