Korean

chown — Linux basic command

Linux / Basic Linux commands / chown.html

Basic Linux commandsOriginalRegistered 2026-10-19T09:00:00+09:00

A command that changes the owner and owning group of files and directories.

Basic Information

Command Namechown (change owner)
One-line IntroductionA command that changes the owner and owning group of files and directories.
Provided byGNU coreutils (Included by default in all Linux distributions)
Official Documentationhttps://man7.org/linux/man-pages/man1/chown.1.html
Supported Operating SystemsLinux, macOS, BSD, WSL
Installation StatusPre-installed (No separate installation required)
ClassificationBasic Linux Command (Tags: owner, permissions, linux, basic)

What is this command?

chown is an abbreviation for "change owner". It is a command used to change the owner (user) and owning group of files and directories. In Linux, file permission management is divided into chmod (changing permissions) and chown (changing ownership).

Root privileges are required, and you can change the owner of an entire directory recursively using the -R option.

What problems does it solve?

  • Changes the owner of web files after deployment.
  • Corrects files with incorrectly assigned owners.
  • Grants file ownership to service accounts.
  • Recursively changes the owner of an entire directory.

Main Functions

Changing Owner

Changes the owner of a file to another user.

  • Use Case: When changing the file owner to something like www-data after deployment.
  • Result: The specified user becomes the file's owner.
  • Limitations: Root privileges are required.

Changing Group

Changes the owning group of a file.

  • Use Case: When setting the group for a team's shared directory.
  • Result: The specified group becomes the owning group.
  • Limitations: You must be a member of the target group (except for root).

Simultaneous Owner & Group Change

Changes both at once using the user:group format.

  • Use Case: When setting the owner and group simultaneously.
  • Result: Both attributes are changed.
  • Limitations: An error occurs if the syntax is incorrect.

Recursive Change (-R)

Applies the owner change to a directory and all files within it.

  • Use Case: When changing the owner of the entire web root directory.
  • Result: All subfiles are changed as well.
  • Limitations: Caution is needed when using on system directories.

Installation and Execution

Checking Pre-installation

Included by default in all Linux distributions.

which chown
chown --version

Checking Current Owner

Check the current owner of a file.

ls -l file.txt
# -rw-r--r-- 1 www-data www-data 1024 Oct 18 12:00 file.txt
#                   ^^^ Owner   ^^^ Group

Practical Examples

Basic Owner Change

Changes the owner of a file.

# Change owner to www-data
sudo chown www-data file.txt

# Change owner and group simultaneously
sudo chown www-data:www-data file.txt

# Change group only
sudo chown :developers file.txt

Recursive Directory Change

Changes the owner of an entire directory.

# Change owner for entire web root
sudo chown -R www-data:www-data /var/www/html/

# Change to specific user ownership
sudo chown -R ubuntu:ubuntu /home/ubuntu/project/

Copying Owner from a Reference File

Copies the ownership from another file as-is.

# Copy ownership from the reference file
sudo chown --reference=template.conf new.conf

# Batch change multiple files
sudo chown www-data:www-data file1.txt file2.txt file3.txt