Casbay Knowledge Base

Search our articles or browse by category below

Change permissions using find command

Last updated: September 8, 2022
Estimated reading time: 1 min

Change permissions using find command

On a Linux server, if you are in need of changing the permissions of a bulk amount of files or directories recursively, we can use the ‘find’ command to do it. The steps are explained below:

Step 1 of 4

Change to the directory in which you need to change the permissions.

Step 2 of 4

The permission changes are different based on the situation we are having. If you need to change the permissions of all files inside the directory to 644 recursively, please use the following:  find . -type f -exec chmod 644 {} \;

You can specify a specific directory in the following way as well: find /home/abc/ -type f -exec chmod 644 {} \;

Step 3 of 4

If you are looking to change the permissions of directories inside the current folder to 755, use the following:find /home/abc/ -type d -exec chmod 755 {} \;

Step 4 of 4

If you are looking to change the permissions of all files having 777 permissions only to 644, use the following: find . -type f -perm 777 -exec chmod 644 {} \;

Use the same format for directories by changing the option f: find . -type d-perm 777 -exec chmod 755 {} \;

The find command

Undeniably, the Linux Find Command is one of the most important and frequently used command command-line utility. We often use the command in Unix-like operating systems. Find command is used to search and locate the list of files and directories. However, it varies according to the conditions you specify for files that match the arguments.

Besides, find can be used in a variety of conditions. For example, you can find files by permissionsusersgroupsfile typedatesize, and other possible criteria.

Click to read the article- File & Folder Permission [INFO]

Was this article helpful?
Dislike 0
Previous: Install Imagemagick PHP extension
Next: Why my website red flagged by browsers? Deceptive website warning.
Discover the perfect balance of performance and budget-friendly Dedicated Server plan !
Discover the perfect balance of performance and budget-friendly Dedicated Server plan !
High performance and low cost Dedicated Server plan 128GB from $185 – upgrade today!
High performance and cheap Dedicated Server plan 128GB from $185 – upgrade today!