Answer the question
In order to leave comments, you need to log in
Permissions of new created files in Ubuntu?
Hello.
I have XAMPP installed on KUBUNTU 14.04.
All projects are stored in the htdocs folder. Take for example the htdocs/example.lc folder. I changed her write permissions to 777, Express777 account, Express777 group.
Apache in Xamp is a member of the daemon group, account daemon.
And when you work as part of some CMS and create a file / page through the admin panel, the file is saved with the rights:
joxi.ru/GrqdPX9fEVBRAz
755( rwxr-xr-x ) for folders daemon daemon
644 ( rw-r--r-- ) for files daemon daemon
Naturally, I have no access to change, or rather my IDE / text editor does not have access. Since they work from the Express777 account.
The reverse situation is similar. When I create a file in the IDE it is saved with permissions
664( rw-rw-r-- ) express777 express777.
That is, CMS can read my files, but it cannot change them (After all, it belongs to others ).
You have to manually run the command sudo chmod -R 777 htdocs/example.lc every time
Question:
How can I change the permissions of all newly created files/folders to 777 in the htdocs folder?
Answer the question
In order to leave comments, you need to log in
Hello :)
You just need to set the rights correctly. And it's not about Apache at all.
1. Give the rights to the daemon group (the group of file owners under which Apache runs) the same as the user of the same name. Those. permissions should be 770 for directories and 660 for files:
chown daemon:daemon /var/www/site -R
find /var/www/site -type f -exec chmod 660 {} \;
find /var/www/site -type d -exec chmod 770 {} \;
usermod -a -G Express777 daemon
I do not recommend using 777 permissions for files.
on the topic:
/etc/apache2/envvars
umask 000
or
umask 002
also, you can run apache as the user you are running under:
AssignUserId user01 group01
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question