Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I think for a development machine, its more convenient to run Apache as the current user to simplify permissions problem? How do I do that? I think its suexec but how do I configure it in Ubuntu+Apache?

share|improve this question

4 Answers 4

up vote 12 down vote accepted

I myself would add the user to the www-data group with...

sudo adduser {username} www-data

Simple and effective. No messing with config files or permissions.

share|improve this answer
    
I did it all the time, but this will not fix some of permission denied issues, as the group rights are not the same as user's rights for all files. –  Kostanos Sep 11 '13 at 17:10
    
This will not fix if the CHMOD didn't allow group to write. –  GusDeCooL Nov 13 '13 at 19:14
    
the issue for me is that I have local installation. When I create files with my IDE they have my 'user/group' and sometime apache is not able to read those files –  Postadelmaga Feb 7 at 9:45

Edit the following file as root: /etc/apache2/envvars

using the command:

sudo nano /etc/apache2/envvars

change the user and group to yourself if there is only one user and you will never have permissions problems again.

I.E., if you are only logging in and running the server as user 'big_dog':

export APACHE_RUN_USER=big_dog
export APACHE_RUN_GROUP=big_dog

Heck, for that matter you could change that user to the current user I'm sure somehow. Then, install user_dir you all have webs only you can have full control of (unless you modify this).

Restart the server (if unsure, just reboot or goole) and you are good to go.

share|improve this answer
2  
This works as a charm! thank you. the only I would add: sudo chown big_dog.big_dog /var/lock/apache2 –  Kostanos Sep 11 '13 at 17:14
1  
Also probably you will need sudo chown big_dog.big_dog -R /var/log/apache2 –  Kostanos Dec 18 '13 at 13:14

Sidestepping the "should you do this" issue, you can find where the user for apache is set by running:

grep www- /etc/apache2/apache2.conf

It's then a case of editing those instances in /etc/apache2/apache2.conf and reloading Apache (sudo /etc/init.d/apache2 reload).

share|improve this answer
    
apache2.conf doesn't contain www- for me –  Jiew Meng Jan 23 '12 at 14:15
    
I have a feeling you meant something like grep -HR "www-" /etc/apache2/. If you already know it's in apache2.conf then just edit that file. In my case, it wasn't there, but in /etc/apache2/envvars as Eric's answer points out. –  Mike Nov 5 at 18:21

why would you do this,, I was strugnling with that perm issues in the past, but this is my dev process from today:

  • install new linux box (virtual, or local like laptop)
  • run standard sudo apt-get install lamp-server^ proc to get lamp up
  • make sym link to my home dir where projects are like this:

    ln -s /home/user/html /var/www/html

  • make sym link to hosts config file

    ln -s /home/user/html/Apache-VirtualHosts.conf /etc/apache/sites-enabled/000-default

that's it :)

It works as aspected, no issues with user perms or something similar with apache server,, for mysql I have little longer process..

hth, cheers

share|improve this answer

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.