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

General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

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

Postby neilms » 10 Feb 2013, 14:01

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.
User avatar
neilms
Member
 
Posts: 156
Joined: 28 Jun 2010, 18:00
Location: Cydonia

Postby fonz » 10 Feb 2013, 14:11

neilms wrote:add someuser to the group operator.

Why don't you just edit [FILE]/etc/group[/FILE] directly?

P.S. I think the command you're looking for is [CMD=#]pw groupmod operator -m someuser[/CMD]
ΔS>0 ⇒ Entropy is here to stay.

"Lawyer" is just "liar" pronounced in a regional accent.
User avatar
fonz
Giant Locked
 
Posts: 2236
Joined: 16 Nov 2008, 16:32
Location: in dreamland, swooning over a woman I can't have

Postby fonz » 10 Feb 2013, 15:06

neilms wrote: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.

I rarely ever touch [man=8]pw[/man]. [FILE]/etc/group[/FILE] can be edited directly (by [FILE]root[/FILE], obviously) and for [FILE]/etc/(master.)passwd[/FILE] there's [man=8]vipw[/man].
ΔS>0 ⇒ Entropy is here to stay.

"Lawyer" is just "liar" pronounced in a regional accent.
User avatar
fonz
Giant Locked
 
Posts: 2236
Joined: 16 Nov 2008, 16:32
Location: in dreamland, swooning over a woman I can't have

Postby jwele » 10 Feb 2013, 15:31

Code: Select all
# pw groupmod operator -m username
jwele
Junior Member
 
Posts: 45
Joined: 14 Aug 2012, 21:16

Postby swa » 10 Feb 2013, 16:37

Hi,

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

[CMD="#"]pw group mod help[/CMD]

Code: Select all
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
swa
Junior Member
 
Posts: 54
Joined: 22 Aug 2009, 17:14
Location: Netherlands


Return to General

Who is online

Users browsing this forum: dpejesh, wblock@ and 0 guests