A
A
Alexander Evgenievich2015-02-10 17:37:47
symfony
Alexander Evgenievich, 2015-02-10 17:37:47

How to solve the problem with permissions when working with tmp directory?

Hello.
PHP The script does the following:
1. Gets a link to the source file (image), which is in the public folder of the site. The file is original.
2. Saves a copy of the file to the tmp directory, then processes the .tmp file. (The direction of processing does not matter)
3. After the processing is completed, the script moves the file from the tmp folder to the public folder. The file must be available on the site, but its permissions are as follows:
-rw------- 1 www-data www-data
Accordingly, the file is not available.
Please tell me how to solve this problem so that the moved file has the rights -rw-r--r--
The umask command returns 0022 .
*not strong on Unix
-----
I would like to clarify what you are interested in, is it possible to solve problems with rights and access at the operating system level?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav Fateev, 2015-02-10
@svfat

change the permissions in your script like this:chmod("filename", 0644);

S
Saboteur, 2015-02-10
@saboteur_kiev

One of the obvious answers is to change the umask, or change the permissions on a file already in the public folder (run chmod in the script).
PS /tmp has a special permission bit that allows files to be deleted by the owner of the file, regardless of the file's permissions.

I
Ivan, 2015-02-10
@SpinenkoIA

And who sets the rights to the source files?
Essentially solution 2.
- set permissions when creating
- and when copying

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question