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
:
[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
Now let’s 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
- Basic Unix Commands
- Unix Commands
- ls command
- cd command
- chmod vs chown
- Filesystem navigation commands
- pwd command
- chown examples
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
Now let’s 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
- Basic Unix Commands
- Unix Commands
- ls command
- cd command
- chmod vs chown
- Filesystem navigation commands
- pwd command
- chown examples