Take the 2-minute tour ×

My website creates files with owner apache:apache when uploading a file, like this:

drwxr-xr-x    2 apache apache   4096 Aug 28 14:07 .
drwxr-xr-x 9118 apache apache 233472 Aug 28 14:07 ..
-rw-r--r--    1 apache apache  41550 Aug 28 14:07 468075_large.jpg
-rw-r--r--    1 apache apache  26532 Aug 28 14:07 468075_medium.jpg
-rw-r--r--    1 apache apache  50881 Aug 28 14:07 468075_original.jpg
-rw-r--r--    1 apache apache   4316 Aug 28 14:07 468075_small.jpg

Now I am trying to create a file inside the same folder with the user that owns that domain in Plesk and I get permission denied.

How can I have both apache and shell user with permissions over that files?


share|improve this question
What group are you in? If there is a user group to which both your user and apache are members of chow :theGroup thefile might work (from php, an exec(); or system() call could do that, or just the ````[back-ticks] –  Elias Van Ootegem Aug 28 '12 at 15:07
add comment

3 Answers

You have to create a group and put your Plesk and Apache user in it. Than you have to chmod -R g+rwX on your files.

And set the default umask of your system to 002.

share|improve this answer
add comment

If that shell user is not apache but in the same group, you will need to make the folder group writeable.

chown 755 .

As it is right now it won't allow anyone other than apache to add a folder. Or, you can try to use php to do fopen?

share|improve this answer
add comment

Thanks for the answers but I finally decided to run a cron job that will open a php script from the website using wget.

That way it's the same apache user that already has access to the files. I did this basically because I've got tons of files, about 300GB of images so it would take a lot I think to apply al the new permissions.

share|improve this answer
add comment

Your Answer


