Fix File and Folder Permissions for docroot from Plesk UI
When switching from Apache to FastCGI the Service Provider needs to change the permissions for the customer from apache:apache to <user>:psacln
This can be fixed by having a button in Plesk which does:
find $PLESKDOMAINHTTPDOCS -not -user $PLESKDOMAINOWNER -not -name "plesk-stat" -print0 | xargs -0 chown $PLESKDOMAINOWNER:psacln
find $PLESKDOMAINHTTPDOCS -type d -not -name "plesk-stat" -print0 | xargs -0 chmod 0755
find $PLESKDOMAINHTTPDOCS -type f -not -name ".pl" -not -name ".cgi" -not -name ".sh" -print0 | xargs -0 chmod 0644
find $PLESKDOMAINHTTPDOCS -type f -name ".cgi" -print0 -o -name ".pl" -print0 -o -name ".sh" -print0 | xargs -0 chmod 0755
I have this entirely written in bash already (where I get all needed variables from the DB with domainname as input).
Looks like “plesk repair fs” can help: https://docs.plesk.com/en-US/12.5/administrator-guide/plesk-administration/plesk-repair-utility/plesk-repair-utility-file-system.75675/
Everyone, please continue voting for this feature if you consider it important!
— rk
-
Jay Smith commented
This can also be extended to when the domain is switched from the FastCGI PHP module to the Apache module, where the tool would chown the domain's web document root to apache:apache.