2

Does it exist?

I create a folder with, let's say, all permissions set, and some services (i.e. Apache web server) create subfolders and put files there (uploaded media files from website users). Such subfolders have permissions set so that only www-data (Apache user) can write to them.

My problem arises because I have a script which has to be able to create subfolders and files, the same way as Apache does. But when it tries to write a new file to an existing folder created by Apache, it can't because of the permissions.

Is there any way in Linux (Ubuntu distro) to set so that a newly created subfolder inherits same permissions as parent folder?

I have been reading a while about guid, sticky bits and so, but I am not very savvy in sysadmin, and, in the middle of a rush of work, this whole thing overwhelmes me...

I am using python and mod-wsgi, if this information is useful in any way.

Thanks!

3
  • 1
    Have a look at this similar question: unix.stackexchange.com/questions/18729/… Commented Nov 18, 2011 at 21:11
  • Why would you want to do this? If you chmod a directory to 0700, other users won't be able to get at anything below it, regardless of their permissions. Commented Nov 19, 2011 at 0:01
  • Is your script running also from the web, as in a webpage or something, or are you running it from CLI?
    – reiche
    Commented Aug 15, 2012 at 7:05

1 Answer 1

1

I don't know whether this is the best ownership and permission policy for your setup. Here's how to implement it.

From what I understand, you want several system users to be able to access and write to a set of files, and you want newly created files to automatically have the correct permissions. This is possible with access control lists, and not really feasible without.

This answer explains how to set up your system for ACLs and what permissions to give to the shared directory.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .