Thursday, January 10, 2013

How to change the directories/files permission in unix?


How to change the directories/files permission in unix?

Using the "find" command we can change the permission of all the directories/files very easily.


For example, if we want to change the permission of all the directories and files under /opt/hddocs then follow the below commands,

To change all the directories under /opt/hddocs to 755:

    find /opt/hddocs -type d -exec chmod 755 {} \;

To change all the files to 644:

    find /opt/hddocs -type f -exec chmod 644 {} \;