How chown Works in Kali Linux

Change file and directory ownership safely and correctly—plus practical examples.

Overview

The chown (change owner) command changes the ownership of files and directories. Ownership has two parts:

  • User (Owner): the account that owns the file.
  • Group: a set of users who can share access via group permissions.
By default, the creator of a file is its owner. Administrators (or root) use chown to transfer ownership so the right people (or services) control the right files.

Basic Syntax

chown [OPTIONS] NEW_OWNER[:NEW_GROUP] FILE...

Parameters

  • NEW_OWNER – user that will own the file
  • NEW_GROUP – (optional) group to assign
  • FILE... – one or more files/directories

Common Options

  • -R – recursive (apply to contents)
  • -v – verbose (show what changed)
  • -c – report changes only
  • --reference=<path> – copy owner:group from another file

Examples

1) Change owner of a single file

sudo chown alice file.txt

Owner becomes alice; group stays the same.

2) Change owner and group

sudo chown alice:developers project.zip

New owner: alice; new group: developers.

3) Change only the group

sudo chown :admins report.log

Owner remains unchanged; group becomes admins.

4) Change ownership of a directory recursively

sudo chown -R bob:bob /home/bob/projects

Applies to the directory and all files/subdirectories within it.

5) Verify ownership

ls -l file.txt

-rw-r--r-- 1 alice developers 1024 Sep  3 10:00 file.txt
  • alice → owner
  • developers → group

Why It Matters in Kali Linux

  • Security: prevents unauthorized modification of sensitive files.
  • Collaboration: shared projects need correct group ownership.
  • Administration: system services often require specific owners/groups.

Quick Tips

  • Use sudo (or be root) to change ownership on files you don’t own.
  • Pair with chmod to adjust permissions after changing ownership.
  • Test on a copy or use -v/-c to see exactly what changed.
  • Be careful with -R; it affects everything inside the directory tree.

Summary

  • chown [OPTIONS] USER[:GROUP] FILE... changes file/directory ownership.
  • -R applies changes recursively to all contents.
  • Confirm results with ls -l and review owner/group columns.