How To Set Permission For Folders and Subfolders in Linux


During daily Linux administration we generally work generally with file and directory permissions. In this tutorial we will look different examples about how to change and revert Linux file and directory permissions.

There is different ways to set folder and sub folder permission in Linux but here we will describe most convenient way.

Read Only Owner

Say we have folder /opt/lamp and we want to change all sub folders permission to change 600. Using chmod with recursive options is the simplest one.

Read By Group But Not Edited

We may want to read by the owner group but not changed. We will set binary permission 660 for this.

Read By Others But Can Not Edit

Another useful permission is given other users read permission but denying from editing the file. We will use 664binary permission.

Change Directory Permission with Find

If we only want to change permission of directory we need to specify the type as directory .

Change File Permission with Find

We can specify the type as file and change only files permissions. In this example we will change files located at /opt/lamp to 660 .

Change File Permission According Extension with Find

We can specify the file extension we want to change the permission to the find command. In this example we will look directory /opt/lamp and change permission of .c extension files to the 660 .

LEARN MORE  Linux curl Command Tutorial With Examples

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)