Skip to content

Instantly share code, notes, and snippets.

@zachbrowne
Created April 20, 2012 21:00
Show Gist options
  • Save zachbrowne/2431863 to your computer and use it in GitHub Desktop.
Save zachbrowne/2431863 to your computer and use it in GitHub Desktop.
Fix Apache2 security on websites.
#!/bin/bash
##########################################################
# Fix Apache Security for Ubuntu 11.10 64bit Web Server #
# by Zach Browne - http://zachbrowne.com #
##########################################################
USERNAME=zach # Change to your username
USER_ID=www-data # Change if needed
USER_GROUP=www-data # Change if needed
find {/home/$USERNAME/domains/public_html,/home/$USERNAME/domains/logs} -type d -exec chmod 755 {} \;
find {/home/$USERNAME/domains/public_html,/home/$USERNAME/domains/logs} -type f -exec chmod 644 {} \;
chown -R $USER_ID:$GROUP_ID {/home/$USERNAME/domains/public_html,/home/$USERNAME/domains/logs};
echo "Fixed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment