⌨️chown
Also known as chown Command, Change Owner, File Ownership
A command that changes which user and group own a file.
Think of it like
Think of it like writing a new name on a lunch box. Now it belongs to someone else.
Example
Jack copies a website into place with sudo, so root owns it. The web server cannot write to it until Jack runs chown.
Why it matters
A program can only use files that its user may touch. A wrong owner is a common cause of errors.
Definition
Example code
console
$ sudo chown www-data:www-data index.html
$ ls -l index.html
-rw-r--r-- 1 www-data www-data 512 Nov 16 10:05 index.htmlCommon mistake
Key takeaways
- 1User:group. Set both at once.
- 2Needs sudo. Only root gives files away.
- 3-R for folders. Changes everything inside.