Skip to content

Instantly share code, notes, and snippets.

@phred
Created December 15, 2009 22:17
Show Gist options
  • Save phred/257359 to your computer and use it in GitHub Desktop.
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.
#!/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