42

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?

3 Answers3

55

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 {} +

aguslr
  • 848
11

For drwxr-xr-x it is:

chmod 755  the_path_to_target

For drwxrwxr-x it is:

chmod 775  the_path_to_target
serenesat
  • 1,326
3

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