问题
I have an Amazon EC2 server with multiple user accounts. Each user installs a PHP-based CMS system which during the install process downloads a few packages from a remote repository. The problem is that downloaded packages are not writable for the user (ei. cannot be deleted).
Question is, how can I set the default file permission for files created by PHP to 666?
Many thanks!
回答1:
You can use find
to find all of the files that are owned by apache and then chmod
them with the desired permissions.
For example:find <your direcoty path> -type f -user "apache" -exec chmod 666 {} \;
will change the permissions of all files owned by apache
in the specified path recursively.
While I was searching the web I found this answer, which I think, is a more proper way to handle your problem.
来源:https://stackoverflow.com/questions/12672815/changing-default-file-permissions-for-files-created-by-php