Linux for Developers
/Intermediate
chown
Definition
Change Owner. The command used to change the user and/or group ownership of a given file or directory.
Explain Like I'm New
Transferring the deed to a house. If I create a file, I own it. I can use `chown` to give the file to you.
Real World Example
A web server runs as the user `www-data`. You upload website files as the user `root`. The web server gets a 'Permission Denied' error because it doesn't own the files. You run `chown -R www-data:www-data /var/www/html` to fix it.
Common Use Cases
- •Fixing web server permissions
- •Transferring file ownership
Interview Questions
basic
- Can a normal user use `chown` to give away their files to the `root` user?
intermediate
- In the command `chown alice:developers file.txt`, what does 'developers' represent?