chown – change file/directory ownership

IMPORTANT: chown needs to be run as root.

chown example

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

{% highlight console %} [root@rhel8 /home/greys]# touch try {% endhighlight %}

it belongs to user root and group root:

{% highlight console %} [root@rhel8 /home/greys]# ls -al try -rw-r–r–. 1 root root 0 Feb 20 06:44 try {% endhighlight %}

Now let’s change ownership to user greys and group wheel {% highlight console %} [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 {% endhighlight %}

See Also