Linux Terminal Command: chown

The chown command is an essential tool in User & Permission Management. In this tutorial, we will explore what chown does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The chown command modifies the user and group ownership of files and directories. Requires superuser privileges.


Common Options & Syntax

chown [options] [arguments]

Here are the most common flags used with chown:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
sudo chown jehb archive.tar

What it does: Changes the owner of ‘archive.tar’ to user ‘jehb’.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
sudo chown -R www-data:www-data /var/www/html

What it does: Recursively (-R) changes both owner and group of /var/www/html to the web server user ‘www-data’.


⚙️ Warning & Common Pitfalls

[!WARNING] Running chown -R on system folders (like /usr or /etc) can break system configurations since services rely on specific user owners to run safely.


Here are some related posts on cli_tty1 you might want to check out: