The chown command
change file owner and group 11 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.
Options in the examples
-R, --recursive- operate on files and directories recursively
Examples
chown user file
chown user:group file
chown :group fileChange only group
chown student myfile.txt
chown student:student myfile.txt
chown -R student:student directory/
sudo chown root:root sensitive.txt
sudo chown -R www-data:www-data /var/www/html
sudo chown -R www-data:www-data /var/www/html/
chown NAME:NAME /home/NAME/projectsOwner and group
sudo chown worker /etc/worker/config.ymlGive the file to the service's user