Skip to content

Instantly share code, notes, and snippets.

@asahasrabuddhe
Created April 2, 2018 09:22
Show Gist options
  • Save asahasrabuddhe/c7a690b3bb1f70fa1645c7d8869c73b4 to your computer and use it in GitHub Desktop.
Save asahasrabuddhe/c7a690b3bb1f70fa1645c7d8869c73b4 to your computer and use it in GitHub Desktop.
Directory and File Permissions
#Find all files in the given path and apply permissions 664 to them
sudo find <path> -type f -exec chmod 664 {} \;
#Find all directories in the given path and apply permissions 775 to them
sudo find <path> -type d -exec chmod 775 {} \;
#Set the group id on the directory so that the files created in this directory in the future are automatically owned by the group
sudo find <path> /var/www -type d -exec chmod g+s {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment