1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do you use pw to add a user to operator group?

Discussion in 'General' started by neilms, Feb 10, 2013.

  1. neilms

    neilms New Member

    Messages:
    160
    Likes Received:
    0
    The FreeBSD handbook is not clear about this. pw is a command that has so many options that it is simply confusing for a normal user. I want to do something that would be easy under gnome desktop:

    add someuser to the group operator.

    That is all.
    How is this done with pw? IMHO pw is an example of a command being made into something so overly complex that it is incomprehensible. If I had an alternative I would not touch it.
     
  2. fonz

    fonz Moderator Staff Member Moderator

    Messages:
    2,437
    Likes Received:
    5
    Why don't you just edit /etc/group directly?

    P.S. I think the command you're looking for is # pw groupmod operator -m someuser
     
  3. fonz

    fonz Moderator Staff Member Moderator

    Messages:
    2,437
    Likes Received:
    5
    I rarely ever touch pw(8). /etc/group can be edited directly (by root, obviously) and for /etc/(master.)passwd there's vipw(8).
     
  4. jwele

    jwele New Member

    Messages:
    45
    Likes Received:
    0
    Code:
    # pw groupmod operator -m username
     
  5. swa

    swa New Member

    Messages:
    54
    Likes Received:
    0
    Hi,

    I always use the help switch for things like this, because I am too lazy to remember those options ;)

    # pw group mod help

    Code:
    usage: pw groupmod [group|gid] [switches]
    	-V etcdir      alternate /etc location
    	-C config      configuration file
    	-q             quiet operation
    	-F             force add if not exists
    	-n name        group name
    	-g gid         group id
    	-M usr1,usr2   replaces users as group members
    	-m usr1,usr2   add users as group members
    	-d usr1,usr2   delete users as group members
    	-l name        new group name
    	-Y             update NIS maps
    	-N             no update
    As mentioned above, you need -m