Ad space (banner)
🖥️Linux Lessons
Lesson 40 / 61

Changing a File's Owner with chown

chown is for when "I want to change this file's owner to a different user." chown stands for change owner, and it changes a file or folder's owner.

Use it in the form chown username filename. To change the owning group at the same time, use chown username:groupname filename.

Running chown user notes.txt changes the owner of notes.txt to the user user. Changing ownership usually requires administrator privileges.

A common early mistake is confusing chmod (changing permissions) with chown (changing the owner). If you want to change who can touch it, that's chown; if you want to change what they can do, that's chmod.

In real work, this is used to hand file ownership over to a web server's execution user, or to organize file ownership by department on a shared server.

Linux
Try it (type this into the pseudo terminal)
chown user notes.txt

🧑‍💻 You can type this command into the Linux pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)