7 views

To give full permission to folder and subfolders recursively,

find /PATH-TO-DIR/ -type d -exec chmod 777 {} \;

/PATH-TO-DIR/
This is the parent directory you want to change permission.

find /PATH-TO-DIR/ -type d
This will give a list of directories under your /PATH-TO-DIR/

-exec 777 {} \;
This will execute chmod 777 on to the above list of directories given by find command.

Listing the directories before changing permission, we are taking ./demo for example

[developer@vm-askdevops2 ~]$ find ./demo -type d -ls
33554498    0 drwx------   3 developer developer       16 Aug 11 02:39 ./demo
67154369    0 drwx------   3 developer developer       16 Aug 11 02:39 ./demo/d1
100663361   0 drwx------   3 developer developer       16 Aug 11 02:39 ./demo/d1/d2
    72      0 drwx------   3 developer developer       16 Aug 11 02:39 ./demo/d1/d2/d3
33554499    0 drwx------   2 developer developer        6 Aug 11 02:39 ./demo/d1/d2/d3/d4

In the above list, all directories (folders) are having RWX permission to the owner only.

Changing the permission

[developer@vm-askdevops2 ~]$ find ./demo -type d -exec chmod 777 {} \;

Listing the directories after changing the permission

[developer@vm-askdevops2 ~]$ find ./demo -type d -ls
33554498    0 drwxrwxrwx   3 developer developer       16 Aug 11 02:39 ./demo
67154369    0 drwxrwxrwx   3 developer developer       16 Aug 11 02:39 ./demo/d1
100663361   0 drwxrwxrwx   3 developer developer       16 Aug 11 02:39 ./demo/d1/d2
    72      0 drwxrwxrwx   3 developer developer       16 Aug 11 02:39 ./demo/d1/d2/d3
33554499    0 drwxrwxrwx   2 developer developer        6 Aug 11 02:39 ./demo/d1/d2/d3/d4

Now, all users are having all permissions, read, write and execute (WARNING: including deletion).

Jan 14, 2012 by | 7 views
DevOpsRun.com is LIVE!

Articles for DevOps Geeks
MobaXterm Customization
CHMOD Explained!
Bash history powerful tips
Ubuntu bash from Windows
..