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?
-
Search and read up on "linux file permissions and groups". There are several good tutorials. Most users won't need to create new groups. – Joe P Jun 05 '17 at 14:40
-
1Related: What do the groups do in “Users and Groups”? – steeldriver Jun 05 '17 at 14:41
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.

- 197,895
- 55
- 485
- 740
-
1WARNING Many disaster scenarios begin with
sudo chown -R
(orsudo chmod -R
). Please do not usesudo chown -R
in an answer to a fairly new user. – waltinator Jun 05 '17 at 16:27