Task:

Recursively change permissions:
user:
rwx - for directories
rw - for files
group:
rx - for directories
r - for files
other:
rx - for directories
r - for files

Solution:

chmod -R u+rwX,go+rX,go-w /directory

Explanation:

Quote from HP-UX chmod man page about 'X' (capital X) option:

X    Conditionally add or delete the
     execute/search permission as follows:
         +  If file is a directory, add or delete
            the search permission to the existing
            file mode for who.  (Same as x.)
         +  If file is not a directory, and the
            current file permissions include the
            execute permission (ls -l displays an x
            or an s) for at least one of user,
            group, or other, then add or delete the
            execute file permission for who.
         +  If file is not a directory, and no
            execute permissions are set in the
            current file mode, then do not change
            any execute permission.

Copy directory tree with access rights but without files

Tue 15 April 2014 by Mikhail Basov

To copy only directory structure with access rights from current directory (./) to target directory (../test1) issue the following command:

read more