How do I change Kirby’s default behavior at folder creation from a 755 to a 775 permission?
This is because git is run with user A, who is in the www-data group, and php is run by user www-data. So changes applied by git have user A and changes applied by the panel on www-data. When I pull or push the last contents or when I pull the modifications on the code I would need the group to be able to read and write.
Somebody would have a solution to either Kirby’s or git’s configuration. Do you use git with the www-data user?
I don’t know if there is a dedicated setting for that but you could try to make use of the page.create:after
Hook.
I assume that you mean folders within the content directory.
Thanks, that might be a solution, using :
<?php chmod("/somedir", 0775); ?>
But I’m wondering if it wouldn’t be better to look at my git configuration ?
I’d use a git post-deploy hook with a script that changes permissions
Thank you for your answers. I will see what strategy to adopt.
I assume you are talking about file/dir permissions on a *nix OS. My last approach to this issue has been the change of the systems default file/dir create mode from 644/755 to 664/775 and to put the various users in one common group (in addition to their default group), i.e. your git user into group www-data
and your web servers user (www-data
) into group users
(assuming your git user’s default group is users
. This way, a file/dir created by either process has the group write bit set and can be written/deleted by members of the same group.
Another possible solution might be to set the suid or maybe even better the guid bit to a common group, where all necessary users are member of, but I have never played around with that.