Skip to content

Instantly share code, notes, and snippets.

@boywijnmaalen
Last active April 9, 2018 05:06
Show Gist options
  • Select an option

  • Save boywijnmaalen/5c7cb36872c91f188a80d24c024b239c to your computer and use it in GitHub Desktop.

Select an option

Save boywijnmaalen/5c7cb36872c91f188a80d24c024b239c to your computer and use it in GitHub Desktop.
Recursively change permissions
# 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