0

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?

2 Answers 2

2

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
3
  • for reference, "sticky" is the same thing as SGID mentioned above.
    – user606723
    Aug 12, 2011 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, 2011 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, 2011 at 19:28
4

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.

2
  • Didn't know about SGID. Thats very handy.
    – user606723
    Aug 12, 2011 at 19:13
  • Yes, it's working on MacOS as well.
    – Sven
    Aug 12, 2011 at 19:20

You must log in to answer this question.

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