Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So here is the issue. A client of mine is using Mac OSX Snow Leopard as his web server. He has multiple clients, and sites, etc. He also has multiple designers who access the system.

He has a user who he has locked down to certain directories (for sites he only works on). When the user uploads his files, my client has to go in a root to set the owner to _www so that Apache will have permissions to run the files.

What he'd like to know is remove the need to constantly have to go in behind the user to propagate the permissions on the files. In Windows, he is just using Filezilla without a problem since the user isn't integrated into the OS.

Any ideas how to accomplish this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Set the group permissions of the directory to SGID (chmod g+s dirname), and the group of every newly created file or subdirectoy will be inherited to be _www.

But you have to do this for every existing subdirectory, as the SGID bit is not propagated to already existing subdirectories.

chgrp -R _www path/to/userdir 
find /path/to/userdir -type d -print0 | xargs -0 chmod g+s
share|improve this answer
    
for reference, "sticky" is the same thing as SGID mentioned above. –  user606723 Aug 12 '11 at 19:21
    
Actually, it's not the same because even after 15+ years, I mess up this term. The sticky bit means something else. Shame on me. –  Sven Aug 12 '11 at 19:25
    
Ah, I knew sticky bit as something else, but I figured that maybe the term was broader than I had initially realized. –  user606723 Aug 12 '11 at 19:28

I don't have a mac system handy to verify but...

In Linux, I'd use the SGID bit on the directory and make the directory group the group Apache runs under. All files created in that directory will have the group automatically set to the directory group, and hence will be readable to Apache. No changing of permissions involved.

share|improve this answer
    
I'll look into that and verify - thanks! –  cole Aug 12 '11 at 19:13
    
Didn't know about SGID. Thats very handy. –  user606723 Aug 12 '11 at 19:13
    
Yes, it's working on MacOS as well. –  Sven Aug 12 '11 at 19:20

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.