Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am using webmin to install apache and run Wordpress, and i am getting some permission errors. Here is what I have done so far:

I have installed webmin apache, it is running under the user:group apache:apache.

I then created a new user, newuser, which is running under the user:group newuser:newuser.

I created a new webmin virtual directory with:

  • server name: newdomain.com
  • document root: /home/newuser/www
  • alternative virtual server names: www.newuser.com

All files within the /home/newuser/www directory are chowned to newuser:newuser

I installed WordPress which runs, however when running WordPress i am getting errors uploading files, such as error: The uploaded file could not be moved to wp-content/uploads.

If I chown the users files to apache:apache, it works. However, the user then cannot edit files in their home directory which are owned by apache.

I have seen on cPanel apache runs as the user for the site which is being accessed (i.e. all files in the directory are user:user, as opposed to apache:apache).

How can i achieve the same with webmin, specifically allowing apache to run, but users being able to upload and edit files in their directory?

share|improve this question
    
I can't exactly tell you about how this is configured in webmin, but the main problem here is using PHP via apache module (this way PHP scripts are running under the apache user, which leads to the problems you described) versus using PHP via fastcgi (this way PHP scripts run under the web user). Look for any option in webmin to run PHP via fastcgi. –  etagenklo Nov 5 '13 at 10:32

1 Answer 1

Your user should own the files, then give to the apache group the right to read files (only give the right to the apache group to write in directories it has to write in !)

In your example, the upload directory rights should look like this :

drwxrwx---  5 newuser apache 4096 Oct 31 18:46 upload

For a directory Apache don't have to write in, it should look like this :

drwxr-x---  5 newuser apache 4096 Oct 31 18:46 config
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.