How to CHOWN all Subfolders and Files

Updated

In Linux, the chown command will change directories or files ownership. This is important when different scripts or utilities expect certain permissions or ownership in order to do operations. A good example is the automatic update utility in WordPress. WordPress expects the plugin in folders and files to have www-data ownership.

If you are using the chown command and notice that the ownership isn’t cascading down to the subfolders and files then a simple command switch will do the trick.

How to CHOWN all Subfolders and Files

In order to make sure chown changes ownership for subfolder and files simply add the -R switch. This switch means recursively change ownership.

chown -R USER:GROUP FOLDER
      
    

For Example

chown -R www-data:www-data wp-plugin-folder
      
    
CHOWN Commands

That’s all there is to it. To see other switches you can use with chown you can view its documentation.