Every file or directory has a owner. These are set with the creation of the file or directory.
[root@server1 /]# ll totaal 28 lrwxrwxrwx. 1 root root 7 4 nov 2020 bin -> usr/bin dr-xr-xr-x. 5 root root 4096 5 mei 14:38 boot drwxr-xr-x. 19 root root 3360 1 jun 00:09 dev drwxr-xr-x. 105 root root 8192 13 jun 13:50 etc
The first name (root) is the users name. The second is the groups name.
To change ownership you must be the owner or root.
# chown user:group (-R) ......
The owner can also be a deamon like postfix or apache.
drwxr-xr-x. 2 root root 204 4 nov 2020 anaconda -rw-------. 1 root root 0 1 jun 03:26 boot.log -rw-------. 1 root utmp 0 1 jun 03:26 btmp drwxr-xr-x. 2 chrony chrony 6 8 aug 2019 chrony -rw-------. 1 root root 9319409 17 jun 13:09 messages -rw-r--r--. 1 named named 100855301 17 jun 12:29 named.log drwxrwx---. 2 apache root 127 7 jun 09:34 php-fpm drwxr-x---. 2 prosody prosody 165 2 jun 21:37 prosody drwxr-x---. 2 redis redis 49 3 jun 03:45 redis drwxr-xr-x. 2 root root 6 4 nov 2020 rhsm
chown always clears the setuid and setgid bits.
For help type:
# chown --help