I'm curious to know what the chown command does. In the manual page it says the chown command changes the file owner and group. I know the owner is the one that created the file(unless changed), but what are groups and when do we create a group?
1 Answers
This command is used to change the ownership of a file or a folder. We can change the ownership of a single folder or multiple folders included in it.
Mostly there will be two users.
- root
- customuser
NB: 'customuser' is your username. It will be vary with each system. You can check your username with typing whoami in terminal.
sometimes you can't copy/move/delete a file from certain folders. Because of the ownership problem. You can check the ownership of a folder by ll command (ll foldername).
To use chown, you should aware of what you gonna do. Else your system got busted. So aware of it.
Here is an example: I have a folder in home folder named 'test'. And its owner is 'root'. I have many files/folders in 'test' folder. I need to change the ownership of entire 'test' folder and its sub folders to 'customuser'. I can change the permission by typing:
sudo chown -R customuser:customuser /home/customuser/test
-R means recursive.
first customuser used for owner.
second customuser used for group.
- 207,228