FreeBSD: add or remove an user to a group

Pubblicato il: aprile 5, 2011
Tag: , , ,
Categorie: BSD

If you need to add an user to an existing group, or more than one, do:

pw usermod username -G group1,group2,group3

Remember that the user will be inserted ONLY in the groups that you have specified in the grouplist. If your user is in the wheel group and you do a -G ftp,games he’ll be removed from wheel and you’ll not be able to su- to root.

If you need to create a group:

pw groupadd groupname

If you need to see the users of a group:

pw groupshow groupname

If you need to remove an user from a group (for example, group2) you have to set a new list of groups and you’ve to know in which groups the user is currently:

id -Gn username
pw usermod username -G group1,group3

1 Commento - Lascia un commento
  1. Sergei G scrive:

    Correct way to remove group:

    pw groupmod groupname -d userName

Lascia un commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Benvenuto , oggi è mercoledì, giugno 25, 2014