I know what chgrp and chown do.
My question is since chown does the same thing as chgrp (and even more), what is the point of chgrp?
Asked
Active
Viewed 1.6k times
21
geedoubleya
- 4,267
- 1
- 21
- 20
user2739974
- 311
- 1
- 2
- 3
-
4Unix philosophy: One tool to do one thing. Make a simple and work. Not complex. – SailorCire Oct 29 '14 at 17:12
-
11Historically, the `chown` command accepted _only_ a new owner, or maybe owner[:group]. You couldn't say just `chown :groupname`, so the `chgrp` command was necessary. – G-Man Says 'Reinstate Monica' Oct 29 '14 at 17:19
-
`chown :groupname` works fine for me. – Old Geezer Feb 24 '18 at 07:34
2 Answers
14
When you use chgrp you are using a simple tool to change one thing... group permissions. For many people this is preferred over using chown, especially when you run the risk of mistyping a character while using the chown command and completely breaking permissions to whatever files/folder you specified.
So instead of doing one of the following:
chown user:group [file/dir]
chown :group [file/dir]
You just do:
chgrp group [file/dir]
This keeps the risks of changing file permissions in a production grade environment down. Which is always good for SysAdmins.
devnull
- 5,331
- 21
- 36
3
Remember:
- A file is owned by exactly one group and one user. That file may have varying permissions depending on the user and/or group attempting to use it.
chownchanges ownership of files to specified user/groupchmodchanges permissions of files to specified user/groupchgrpchanges ownership of files to specified group
Kusalananda
- 320,670
- 36
- 633
- 936
KeyC0de
- 145
- 1
- 6