How To Chown Recursively In Linux? – POFTUT

How To Chown Recursively In Linux?

Linux files and folders have owners. Owners are required to control permissions. Which user can access which files. User root created file will be owned by user root. But what will happen we want to change owner.

Simply Recursively Change Files and Directories Owner User and Group

We can change files and folders owner user and owner group with the recursive option -R. In this example, we will change the owner user and group files and folders located in the /home/ismail into ismail. We will also use the sudo in order to change all files and folders without error by using root administrative power.

We can check the new owner user and group with

Simply Recursively Change Files and Directories Owner User and Group

Simply Recursively Change Files and Directories Owner User and Group

We will change the owner and group which is specified with ismail:ismail  in /home/ismail directory recursively. Keep in mind that to change owner user and a group of files we need root privileges.

Specify File Types

While changing owner user and groups we can specify file types to recursively change. We use find command to find specified file type for specified path recursively and send these files as input to chown command.

Specify File Types

Specify File Types

In this example find command is searching in /home/ismail for pdf extensions and run chown command for all files it founds.

LEARN MORE  Linux umask Command Tutorial with Examples, Numeric and Symbolic Representations

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)