Guide to Chmod Permissions of Only Directories in Linux

The chmod command in Linux is a very valuable and often necessary function for fixing permissions of directories and their contents on a publicly accessible server.

When you are needing to change linx octet permissions for many folders and child folders and their contents, the -R recursive switch is of great value, as it saves you the trouble of having to switch directories and execute the chmod command time and time again.

Unfortunately, chmod is only able to execute commands on input parameters passed along to it specifying matches in the file name, and whether or not to chmod recursively or not. If your desire is to only chmod directories, but not the files, you have a problem.

To bypass the chmod command limitation, we will be utilizing stdin to stdout capability of the find and chmod commands.  Since find and chmod take advantage of  standard input / standard output capability, we are able to have them cross communicate sequentially in order to selectively pass along files to be chmod’ed which match our find query. Continue Reading

Recursively chmod permissions of only files in linux

So, you want to change the Linux permissions of all files in a directory and all sub directories, but not affect the permissions of the folders?

This simple guide will show you how to do a recursive chmod changing only the permissions of files, while leaving the permissions for all directories untouched.

The recursive chmod-files-only syntax:

The following shell command will chmod all files only (and ignore the directories) setting the permissions to 644. Continue Reading