To change ownership recursively for a directory and all its contents, you can use the -R option with the chown command. The syntax is as follows:
sudo chown -R [new_owner:new_group] [directory]
new_owneris the username of the new owner.new_groupis the group name of the new group (optional).directoryis the path of the directory whose ownership you want to change, including all files and subdirectories within it.
For example, to change the ownership of a directory named data_directory and all its contents to user datauser and group datagroup, you would use:
sudo chown -R datauser:datagroup data_directory
This command will apply the ownership change to data_directory and every file and subdirectory inside it.
