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.

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!

share|improve this question
1  
Have a look at this similar question: unix.stackexchange.com/questions/18729/… –  Stéphane Gimenez Nov 18 '11 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. –  amphetamachine Nov 19 '11 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 Aug 15 '12 at 7:05
add comment

1 Answer

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.

share|improve this answer
    
Ubuntu ACL setup guide: help.ubuntu.com/community/… –  Christopher Jan 12 '13 at 15:47
add comment

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.