Last Updated: February 25, 2016
· geyer

Linux: Tired of running chmod and chown on your Apache files?

For the guys and girls running Linux, and developing on their own machines - change the Apache user to yourself, for less permission headaches:

On Ubuntu we would run the following commands from a terminal:

$ sudo -s
[sudo] password for XXX: <your password>
$ gedit /etc/apache2/envvars

Look for the lines that say:

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

And change them to:

export APACHE_RUN_USER=<your username>
export APACHE_RUN_GROUP=<your group>

Save the file, and close gedit.

We now need to change ownership on the existing files (for the last time), and then restart apache.

$ chown -R <your username>:<your group> <path to your web root>
$ service apache2 restart

You can now create or edit files and folders, directly in the web root using any application.