Thursday 17 October 2013

Linux Chown Command Examples to Change Owner and Group


The concept of owner and groups for files is fundamental to Linux. Every file is associated with an owner and a group. You can use chown and chgrp commands to change the owner or the group of a particular file or directory.

In this article, we will discuss the ‘chown’ command as it covers most part of the ‘chgrp’ command also.

1. Change the owner of a file
$ls -l filename
-rw-r--r-- 1 srinu chilukuri 0 2013-10-16 20:03 filename

$ chown root filename

$ls -l filename
-rw-r--r-- 1 root chilukuri 0 2013-10-16 20:05 filename

So we see that the owner of the file was changed from ‘srinu’ to ‘root’.