Change Owner 'chown' Command in Linux

Linux Commands

The chown command changes ownership (user or group) of files and directories in a Linux filesystem. Linux is designed to support a large number of users. Because of this, it needs to keep careful track of who is allowed to access a file, and how they can access it. These access rules are called permissions.

There are three major types of file permissions:

  1. User permissions: These permissions apply to a single user who has special access to the file. This user is called the owner.
  2. Group permissions: These apply to a single group of users who have access to the file. This group is the owning group.
  3. Other permissions: These apply to every other user on the system. These users are known as others, or the world.

When a file is created, its owner is the user who created it, and the owning group is the user's current group.

The sytnax is:

chown owner-user file 
chown owner-user:owner-group file
chown owner-user:owner-group directory
chown options owner-user:owner-group file

The user and group to own the file are separated by a colon, with no spaces in between. If the user is omitted, then the group must be preceded by a colon. Only root can change the owner of a file. The owner cannot transfer ownership, unless the owner is root, or uses sudo to run the command.


-R : Recursively change ownership of directories and their contents.


For example, you create a file, myfile.txt, which is owned by root. However, you intend the file to be used by your regular user account, myuser. To change the owner:

chown myuser myfile.txt


Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive