You may find yourself in a situation when you wonder “how do I change permission for a folder and all of its subfolders and files in Linux”?
The answer is really simple. Similar to recursively creating directory structure, you can use the inbuilt option in the chmod command.
I believe you already know that you can change permission on a file using the command chmod. To recursively change the permission of all the files in the given directory and its subdirectories, use the chmod command with the option R:
chmod -R <permission> <directory>
For example, if you want to give read, write and execute access to everyone for all the files in the directory named dir_name, use the command below:
chmod -R 777 dir_name
You can read more about Linux file permissions here.