Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 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 '14 at 4:29

Your Answer


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.