How to Change Directory Permissions in Linux Recursively

As shown in the title of this article, this article is written to describe or to show how to change directory permissions in Linux operating system recursively. In order to do that, an effective way to achieve it is by using an appropriate command executed. The command itself usually executed in a command line interface or a CLI-like utility such as terminal.

In the terminal, there will be a bash-prompt provided or a shell bash-prompt available to execute the command for changing directory permissions in linux recursively. Depends on the user logged-in, usually a normal user can have a default shell-bash prompt for executing command.

So, in order to change the permission of a folder, below is the command pattern :

chmod -Rv permission_attribute directory_target

But the above command execution will change not only directories available inside the directory named ‘directory_target’ recursively but also the files available, stored and located inside the ‘directory_target’ recursively. How to solve the problem for this kind of thing ?. It will be solved by modifying the above command pattern. The command pattern for changing permissions only in the directory recursively and it will not even change the files’s permissions is shown below :

For an example it can be shown below taking a laravel-based web application directory. As it can be seen, the directories available inside, it has a permission of ‘755’ or it can be viewed as ‘rwxr-xr-x’ in the line which has an element id of ‘d’ :