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.

I want to edit the /var/www files using any editor like phpstorm or eclipse etc, without changing the default user/groups setting for /var/www.

Since phpstorm is invoke by a script , I dont know how to make the phpstorm part of www-data group so it get write permission.

What are other options otherwise ?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

PhpStorm should use the same permissions as the user that runs/ launches the script (yourself). Add yourself to the www-data group, or set up a new group.

Let's say you created a new group called "www-pub" and added yourself to it as per instructions.

Remember to log out and back in to have the new group membership take effect. Test your group membership with the groups command.

Then, change permissions of the /var/www directory as follows:

  • chown -R :www-pub /var/www
    • Set the group of all files in /var/www to "www-pub" recursively
  • chmod -R o+r /var/www
    • Allows everyone (including apache) to read all files in /var/www
  • chmod -R g+w /var/www
    • Allows group members to write to all files in /var/www
  • find /var/www -type d -exec chmod g+s
    • sets new files to retain the group of the directory they are created in

If you need apache to also be able to write files (or read files without giving read to everyone else), add apache's user (usually "www-data") to the "www-pub" group.

Also, in PhpStorm's Deployment Options, make sure "override default permissions on (files/ directories)" are either unchecked or set to allow writing by group.

This process should also work for IntelliJ IDEA/ Webstorm.

share|improve this answer
    
thanks @Oleg , I tried adding myself with to www-data group but I did not logout, probably that was the reason it did not work. –  sakhunzai Jul 16 at 4:29

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.