CommandsLinux

Custom Permissions to files/directory in Linux

By September 11, 2012 November 23rd, 2019 No Comments

Most of the times, I was trying to search for the commands to set a different set of permission for the files and directories Recursively. I got it now, and below are the commands to set custom permission. for running the command you should be using the terminal as the root user or use “sudo” to make the command work as superuser.

We need to use two commands together to perform the action. 1. Find2. chmod

Set Permission Recursively to directories only find your_folder -type -exec chmod 775 {} \;

Set Permission Recursively to files only

find your_folder -type -exec chmod 664 {} \;

-the type will check the type of the file you are looking for’ stands for ‘directories’ and ‘f’ stands for ‘files’.

– exec will execute the next command followed in the line.

please let me know If I miss anything or I made any confusion out of this post.