K
K
Khaybulla Musaev2015-11-05 23:24:38
PHP
Khaybulla Musaev, 2015-11-05 23:24:38

How to set file permissions for overwriting by php script?

Hello, dear IT-specialists.
I am writing a simple php script for myself , which climbs on a schedule to a specific folder on my screw, reads the size of the images and, if it is too big, overwrites the images with a resize.
I am using mac os x and this script will also work in this environment.
Files in this folder (and this is the Yandex.Disk cloud folder ) are created with permissions 644 . It turns out that only the owner can change the size. Of course , Apache is run by the www-data user .
Here I had several options:
1) Just change the Apache user. In one of the threads that I created here, they wrote that from a security point of view, this is not the best option.
2) The second option is to set the umask to 002 (now 022 ) so that all files are created with 664 permissions . Then it will be possible to define www-data in the stuff group and it's done. Again - how correct is such a change from a security point of view? .. And is it possible to set the umask for a specific folder? ..
3) Dig in the direction of ACL (I have not come across it). But for some reason they scold this system, and whether it is in mac os x has not yet looked either.
In general, I'm waiting for advice from experts on how best to sort it out here ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-11-05
@musaev_haybulla

and what for to you in this business the Apache and the www-data user?
make a simple console script and run it on the crown from your user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question