Last active
April 25, 2018 21:49
-
-
Save semihcosu/f7ce5c05a62011187bf4354d66cff17d to your computer and use it in GitHub Desktop.
Fix webhost permissions
This file contains hidden or 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/bash | |
owner=$(whoami | awk '{print $1}') | |
if [ "$(whoami)" == 'root' ]; then | |
echo $"You shouldn't be running this as root." | |
exit 1; | |
fi | |
sudo find . -type d -exec chmod 0755 {} \; | |
sudo find . -type f -exec chmod 0644 {} \; | |
sudo chown -R $owner:www-data . | |
echo $"Great! Now you have the permissions you need. Hope you're happy now." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Switch to the directory with
cd ~/project
And run
webhost_permissions
without sudo