Skip to contentSkip to conversation

add an exixsting user to an existing group

DISCUSSION kaushal 4 participants 5 messages Dec 10, 2004 – Dec 12, 2004

lore
Share & tools
lore

kaushal

author
#0 lore raw

hi all,
Is there a command to add an existing user to an existing group?This
will be a supplementary group for the user.He still has his main group unchanged.I want a command instead of manually editing the /etc/group file.

thanks in advance.
bye.

#1 lore raw

Hi list,

Quoted 2 lines · kaushal

I want a command instead of manually  editing the /etc/group file.

"usermod -G xgroupy xusery" for supplementary group(s) or "usermaod -g 4711 xusery" for a new primary group.

Have a lot of fun...

Signature · 14 lines
Mit freundlichen Grüßen

Martin Klier
PC-Benutzerunterstützung / Linux-Server
Asset Management

A.T.U - Auto-Teile-Unger
Dr.-Kilian-Straße 11
92637 Weiden

Telefon:  (0961) 306-5663
Telefax:  (0961) 306-9345663

Internet: www.atu.de
#2 lore raw
In reply to kaushal
Quoted 4 lines · kaushal

Is there a command to add an existing user to an existing group?This
will be a supplementary group for the user.He still has his main group unchanged.I want a command instead of manually editing the /etc/group file.

You can set the list of supplementary groups using usermod, e.g.:

usermod -G group1,group2 user

AFAIK, there isn't a standard command to add or remove specific groups while leaving the rest unchanged.

Signature · 1 line
Glynn Clements <[email protected]>
#3 lore raw
Quoted 6 lines · you
Quoted 4 lines · kaushal

Is there a command to add an existing user to an existing group?This
will be a supplementary group for the user.He still has his main group unchanged.I want a command instead of manually editing the /etc/group file.

Quoted 6 lines

You can set the list of supplementary groups using usermod, e.g.:

usermod -G group1,group2 user

AFAIK, there isn't a standard command to add or remove specific groups while leaving the rest unchanged.

How about gpasswd?
gpasswd (1) - administer the /etc/group file

"gpasswd -a user group" adds user to a supp group, "-d" removes.

Rob

#4 lore raw
Quoted 9 lines · Robert Wood
Quoted 9 lines
Quoted 4 lines

Is there a command to add an existing user to an existing group?This
will be a supplementary group for the user.He still has his main group unchanged.I want a command instead of manually editing the /etc/group file.

You can set the list of supplementary groups using usermod, e.g.:

usermod -G group1,group2 user

Quoted 7 lines
Quoted 2 lines

AFAIK, there isn't a standard command to add or remove specific groups while leaving the rest unchanged.

How about gpasswd?
gpasswd (1) - administer the /etc/group file

"gpasswd -a user group" adds user to a supp group, "-d" removes.

OK, that seems about right.

For some reason, if you pick any one of the manual pages from the shadow package, and follow enough of the "SEE ALSO" cross-references, you'll eventually come across all of the other manual pages. Except the one for gpasswd, which isn't referenced from any of them.

Signature · 1 line
Glynn Clements <[email protected]>