chmod is command line utility for changing permissions of files and directories under Linux/Unix operating system. This tutorial will explain you how to change different-2 permissions for files and directories recursively.
Change Permissions Recursively
For example following command will set permissions 755 (rwxr-xr-wx) on public_html directory in home directory and all its sub directories.
$ chmod -R 755 ~/public_html
But you don’t like to set the similar permissions on files and directories both. So what to do now, How can we set permissions different-2 on files and directories recursively.
Solution is here: Use the following commands to set all directories permission to 755 (rwxr-xr-wx) and all files permissions to 644 (rw-r–r–)
Set Permissions on Directories:
$ find ~/public_html -type d -exec chmod 755 {} ;
Set Permissions on Files:
$ find ~/public_html -type f -exec chmod 644 {} ;