Skip to content

Instantly share code, notes, and snippets.

@kuntau
Created October 14, 2013 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuntau/6972838 to your computer and use it in GitHub Desktop.
Save kuntau/6972838 to your computer and use it in GitHub Desktop.
How to set chmod for a folder and all of its subfolders and files in Linux Ubuntu Terminal?
# The other answers are correct, in that chmod -R 755 will set this as permissions to all files and folders in the tree. But why on earth would you want to? It might make sense for the directories, but why set the execute bit on all the files?
# I suspect what you really want to do is set the directories to 755 and either leave the files alone or set them to 644. For this, you can use the find command. For example:
# To change all the directories to 755 (-rwxr-xr-x):
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
# To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment