Skip to content

How to Change Owner of File in Linux chown Command

How to Change Owner of File in Linux chown Command

Reading Time: 3 minutes

In this tutorial “How to Change Owner of File in Linux chown Command”, We will show you how you can change file and group ownership using the chown command in Linux.

What is chown command

chown – change file owner and group.In the Linux file system, ownership plays a pivotal role in determining access and permissions. The ‘chown’ command, short for “change owner,” is a vital tool for modifying the owner of a file or directory. This guide explores the intricacies of the ‘chown’ command in Linux, shedding light on its syntax, applications, and practical examples.

Understanding Ownership in Linux:

Each file and directory in Linux is associated with both a user (owner) and a group. The combination of user and group ownership dictates who can access and modify the file. The ‘chown’ command allows users to alter the ownership of files, granting specific privileges to different individuals or groups.

Chown Command Syntax:

The syntax for the ‘chown’ command is as follows:

$ chown [options] new_owner[:new_group] file/directory

  • new_owner: The new user owner to be assigned.
  • new_group: (Optional) The new group owner to be assigned.
  • file/directory: The target file or directory.

Common Options:

  1. Reference Options:
    • --reference=file: Sets the owner and group of the target file to match those of the specified reference file.
  2. Recursive Ownership Change:
    • -R, --recursive: Changes ownership recursively for a directory and its contents.
  3. Preserve Root Ownership:
    • --preserve-root: Ensures that ‘chown’ does not operate recursively on ‘/’.
  4. Verbose Output:
    • -v, --verbose: Provides detailed output, displaying the changes made.

How to Change Owner of File in Linux chown Command

Explore the ‘chown’ command in Linux with this guide. Learn the syntax, basic usage, common options, and practical examples. Master changing file ownership effortlessly for effective permissions and access control.

Check the current file owner

$ ls -ld testfile.txt

Check if a new owner account exists on the server

$ id testertechie

In this example, we are going to change the owner and group to testertechie from root hence you see testertechie:testertechie. 1st testertechie is owner and 2nd testertechie after : is the group owner

$ chown testertechie:testertechie testfile.txt

Validate ownership after modification

$ ls -ld testfile.txt

How to Change Owner of File in Linux chown Command

You can compress files using tar command.

More Details:

Advanced Techniques:

Combining ‘chown’ with ‘find’:

Using ‘find’ with ‘chown’ allows for advanced ownership changes based on specific criteria.

$ find /path/to/directory -type f -exec chown new_owner:new_group {} \;

Changing Owner for Multiple Files:

$ chown new_owner *.txt

Updating the owner for multiple files can be achieved using wildcard characters.

$ chown new_owner *.txt

Interactive Mode:

The interactive mode prompts for confirmation before making changes, ensuring user verification.

$ chown -c new_owner:new_group myfile

Q: What is the ‘chown’ command in Linux?

A: The ‘chown’ command in Linux is a powerful tool for changing file ownership. What are its key syntax components?

Q: How do I change the owner of a file in Linux?

A: To change the owner of a file in Linux, use the ‘chown’ command with the desired new owner and the target file. Can this command also change the group owner?

Q: What are common options for the ‘chown’ command?

A: The ‘chown’ command in Linux comes with useful options. How can I recursively change ownership for directories and their contents?

Q: Can I change both the owner and group of a file using ‘chown’?

A: Yes, using the ‘chown’ command, you can change both the owner and group of a file. What is the syntax for this operation?

Q: How do I change ownership for multiple files in Linux?

A: Changing ownership for multiple files is a common task. What is the command structure using ‘chown’ and wildcard characters?


We hope this tutorial “How to Change Owner of File in Linux chown Command” is guided with each step and you can change file owenership. The ‘chown’ command in Linux is an indispensable tool for managing file ownership, a critical aspect of securing file access. By mastering its usage, users gain the ability to precisely control permissions and tailor access to different individuals or groups within the Linux file system.


Leave a Reply

Your email address will not be published. Required fields are marked *