Created
December 15, 2009 22:17
-
-
Save phred/257359 to your computer and use it in GitHub Desktop.
Fix Plesk's vhost group permissions nonsense. Stick this in a cron job to make the headaches go away.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# A hammer to fix group permissions on Plesk vhosts. | |
# | |
# Plesk creates httpdocs directories with correct permissions initially, | |
# and they work properly over FTP (sort of), however, they require special | |
# love to let Apache write to them; namely putting Apache in the psacln | |
# group, making sure that everyone's httpdocs are owned by that group, | |
# and setting the setgid bit on httpdocs and all of its subdirectories | |
# so that new directories created by Apache inherit the proper permissions | |
# and the site's owner can still manage things over FTP. | |
# | |
# You may well criticize this approach for allowing the web server to | |
# write to everyone's httpdocs directory, but I'd like to see you come | |
# up with something better, especially considering that Plesk doesn't | |
# understand ACLs. The out-of-the-box Plesk solution doesn't have | |
# a mechanism to let Apache write to the files other than giving them | |
# world-writable permissions, and hence is broken for any practical | |
# usage. | |
# | |
/bin/chgrp -R psacln /home/httpd/vhosts/*/httpdocs | |
/usr/bin/find /home/httpd/vhosts/*/httpdocs -type d -exec /bin/chmod g+s {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment