问题
I use Mac OS operating system for doing some local development and I don't want to change the default document root of Apache, which is /Library/WebServer/Documents/
I put my projects under that directory. But when I editing files, Sublime Text usually asks for the password when saving the changes. Without moving the projects to a less protected location, how can I let Sublime Text access those folders and files with full permission? What about changing the owner group to something and adding Sublime Text into that group? Apache user also must be in that group in order to allow it do file operations? Another option could be adding Sublime Text to _www
group and chown
'ing document root for _www
group?
回答1:
The non command line is:
- Open Finder
- Go to the folder
- Right Click
- Get Info
- There is a Sharing & Permissions area
- If everything is grey out, just click on the padlock
- Click on the Plus Sign
- Add your mac user
- Set Read & Write Permission
Done. Sublime text can save stuff now
回答2:
You're going to need write permissions to that directory, one way or another. I believe Sublime Text just runs/saves as your user.
You could add yourself to the _www group and make /Library/WebServer/Documents/ group writeable (chmod 775 /Library/WebServer/Documents/
).
Apache only needs to read from that directory (unless you're doing something like uploading images, saving state files, etc). So if apache and other users on your computer don't need to write to that directory, it's fine to make it owned by you (chown $USER /Library/WebServer/Documents/
).
来源:https://stackoverflow.com/questions/20019200/how-to-give-sublime-text-3-write-permission-to-files-in-web-servers-documentroo