How to set the permission drwxr-xr-x to other folders?

I have few directores inside a folder like below –

teckapp@machineA:/opt/keeper$ ls -ltrh
total 8.0K
drwxr-xr-x 10 teckapp cloudmgr 4.0K Feb  9 10:22 keeper-3.4.6
drwxr-xr-x  3 teckapp cloudmgr   4.0K Feb 12 01:44 data

I have some other folder as well in some other machines for which I need to change the permission to the above one like this drwxr-xr-x.

Meaning how can I change any folder permissions to drwxr-xr-x? I know I need to use chmod command with this but what should be the value with chown that I should use for this?

Asked By: user1950349


To apply those permissions to a directory:

chmod 755 directory_name

To apply to all directories inside the current directory:

chmod 755 */

If you want to modify all directories and subdirectories, you’ll need to combine find with chmod:

find . -type d -exec chmod 755 {} +

Answered By: aguslr

For drwxr-xr-x it is:

chmod 755  the_path_to_target

For drwxrwxr-x it is:

chmod 775  the_path_to_target
Answered By: serenesat

As an addition to @aguslr (I do not have enough reputation to comment):

chmod as well as chown has a -R flag, that changes all rights recursively

Answered By: Pibe_chorro
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.