Last active
April 9, 2018 05:06
-
-
Save boywijnmaalen/5c7cb36872c91f188a80d24c024b239c to your computer and use it in GitHub Desktop.
Recursively change 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
| # Recursively change permissions on directories only: | |
| $ find . -type d -exec chmod 777 {} \; | |
| # Breaking it down: | |
| # Uses the find command on the current directory . | |
| # -type d tells find to only look for files of type directory | |
| # -exec tells find to perform the following action on each matching file. In this case it was to chmod each directory to 777. | |
| # This same technique can be used to chown directories and/or perform the same actions on only files. | |
| # Recursively change owner on directories only: | |
| $ find . -type d -exec chown www-data.www-data {} \; | |
| # Recursively chmod/chown on files: | |
| $ find . -type f -exec chmod 644 {} \; | |
| $ find . -type f -exec chown www-data.www-data {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment