chown – change file/directory ownership

chown command helps you to change file and/or directory ownership in Unix.

IMPORTANT: chown needs to be run as root.

chown example

As root user, let’s create a file named “try”:

[root@rhel8 /home/greys]# touch try

it belongs to user root and group root:

[root@rhel8 /home/greys]# ls -al try
-rw-r--r--. 1 root root 0 Feb 20 06:44 try

change ownership to user greys and group wheel

[root@rhel8 /home/greys]# chown greys:wheel try
[root@rhel8 /home/greys]# ls -al try
-rw-r--r--. 1 greys wheel 0 Feb 20 06:44 trl

See Also