-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileStorage: set permissions of files and directories #1199
base: master
Are you sure you want to change the base?
Conversation
But both |
I don't think so. I've tried this code umask(0777);
$file = __DIR__ . '/test.txt';
touch($file);
chmod($file, 0777); and it worked, so the example in the PHP doc doesn't make sense to me. |
But for mkdir('test1'); # depends on system umask
umask(0777);
mkdir('test2'); # depends on PHP's umask
mkdir('test3', 0666); # still depends on PHP's umask, even mode is specified So |
@fabik Yes, that PHP example is wrong. They should use |
Well, that's great! I'll create a pull request that adds chmod() to FileStorage. |
Is it really needed to configure permissions? |
I use the same cache storage for web and its CLI. The web server runs on a different user than CLI, but both users are in the same group. So, I would like to set the permissions of the cached files to 0664 and directories to 0775. |
Hey, I had to change the http server to run under my user on dev mashine to have no problems in CLI. And on production I have to login as the httpserver user... But I guess it is more secure this way. |
Yes, it is more secure. For instance, the CLI user has access to the backup directory, which I don't want to be accessible via web server user. |
991ba1a
to
e23de7a
Compare
489cca2
to
0b969cd
Compare
09a7d92
to
b9698a8
Compare
5a8c108
to
3aa3147
Compare
5feee0e
to
3fc1e40
Compare
688f189
to
1bc9d13
Compare
7215ae6
to
71b2047
Compare
I am still having troubles with issue #1039. It was closed because of umask() problems, but nobody mentioned chmod(). Why cannot FileStorage just get file and directory mode as optional constructor parameters and change file permissions itself?
So, for instance
would call chmod(..., 0664) on all created files and mkdir(..., 0775) on created dirs.
There would be no problems with thread safety as in the case of umask(), or am I wrong?