Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
chgrp GROUP FILE sets the group. root can set any group. A normal user can change the group of an own file, but only to a group he is a member of.
It is the same as chown :GROUP FILE.
Zo schrijf je het
chgrp [OPTION]... GROUP FILE...
chgrp [OPTION]... --reference=RFILE FILE...Opties 14
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Give a folder to a team
chgrp sales /srv/salesCombine with chmod 2770 for a shared folder.
2Change a whole tree
chgrp -R sales /srv/salesAll files and folders inside.
3As a normal user, for your own file
chgrp sales plan.txtWorks only if you are in sales.
4Error when you are not a member
chgrp wheel plan.txt chgrp: changing group of 'plan.txt': Operation not permittedJoin the group first.
5Show what changed
chgrp -Rc sales /srv/salesLists only files that got a new group.
6Use the group of another file
chgrp --reference=/srv/sales /srv/sales/import.csvSame group as the folder.
7Fix files after a group GID change
find /srv -gid 3000 -exec chgrp -h sales {} +Files with the old number get the group name again.
8Group of the web logs for a log team
chgrp -R logreaders /var/log/httpd; chmod -R g+rX /var/log/httpdRead access without root (check that the logs rotate with the same group).
9Group for a config read by a service
chgrp nginx /etc/pki/tls/private/site.key; chmod 640 /etc/pki/tls/private/site.keyThe service reads the key; others cannot.
10Find files of a group (audit)
find /srv -group sales -lsShows everything the group owns.
Niets past bij dit filter.
Exitcodes
0 | Done. |
1 | Error. |