Skip to content

Instantly share code, notes, and snippets.

@davidosomething
Created November 16, 2012 18:27
Show Gist options
  • Save davidosomething/4089660 to your computer and use it in GitHub Desktop.
Save davidosomething/4089660 to your computer and use it in GitHub Desktop.
BASH script to fix permissions of OSX Sites folder
#!/bin/bash
cd /Users/dotrakoun/Sites
# fix owner
echo "Fixing ownership of /Users/dotrakoun/Sites"
sudo chown -R dotrakoun:www /Users/dotrakoun/Sites
# fix file perms
echo "Fixing file permissions of /Users/dotrakoun/Sites"
chmod -R ug+rw /Users/dotrakoun/Sites
# fix dir perms
echo "Removing all execute permissions of all files"
find . -type f -exec chmod -xs {} \;
echo "Adding user-only execute permissions to shell scripts"
find . -type f -name "*.sh" -exec chmod u+x {} \;
echo "Adding user-only execute permissions to git hooks"
find . -type f -regex ".*\.git/hooks/.*" -exec chmod u+x {} \;
echo "Fixing dir permissions of /Users/dotrakoun/Sites"
find . -type d -exec chmod ug+rws {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment