質問

I have a serious problem. Every time I edit my source code, I have to do a chown username:groupname for my htdocs folder. Now if I have to publish my files and have them executed on the webserver, I have to do a chown www:www for things to work right. I have tried to change my username,groupname in httpd.conf to my login in Mac OS but ownership still gets set incorrectly. I just want to be able to edit my source code and then not have to worry about changing the permissions.

What do I do?

役に立ちましたか?

解決

Probably the easiest is to set the sticky bit of the enclosing directory and make www the group of it. So for example if you want to edit files in /Library/WebServer/Documents you would prepare it with

sudo chgrp www /Library/WebServer/Documents
sudo chmod g+s /Library/WebServer/Documents

Then all files you edit (or technically create) in Documents will have www group as well, so as long as your umask is reasonable (e.g. 0022) they will be readable by the web server and you can edit them as you please.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top