skip to Main Content

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?

Thanks.

3

Answers


  1. Chosen as BEST ANSWER

    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.


  2. 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.

    Login or Signup to reply.
  3. 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?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search