I understand what the commands chown and chgrp do however do not understand why you would want to use them apart from assigning ownership to either another user or group? Is this for security purposes or for some other reason?
|
|
|||
|
|
|
Linux or other Unix-style-systems are built as a multi user systems. You have to understand that in this concept not only natural persons count as users, daemons or others programs might run as their own user. For example: It makes sense to create a dedicated user for the apache service, if you want to run a webserver. In this way apache cannot corrupt files for which it has no permission, mostly due it neither directly owns the files nor is in any group the user is in. Basically you seperate access to files, by assigning multiple groups to users you can define spefically who and how they can access certain files. Btw I should add that the file permissions have to be set accordingly. Using |
|||||
|
|
You have understood exactly: you use There isn't a deeper need that you have missed, just the general set of shallow needs expressed by those operations. Millions of reasons why some other user should own a file, but none of them deeper than "because we do it that way". |
|||||||
|
|
If you have a bunch of files saved on a USB flash drive created on one OS and need to use some of those files or all of them on another (Linux) OS, you may need to run a find command and in one instance traverse down a directory tree to chown all of the files and then in another find command follow up with a chgrp command using the -exec feature of the find command in order to use the files (presumably with different user and group ids) so that the files can be used on both different Linux OSes. |
|||
|
|
|
It's due to one simple thing called the Unix philosophy.
At least that's what I assume :) |
|||
|
|