Answer the question
In order to leave comments, you need to log in
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
change the permissions in your script like this:chmod("filename", 0644);
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question