MLUG: [MLUG] Simple command to add a user to a group?
[MLUG] Simple command to add a user to a group?
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Here's a message I wrote to a specialty mailing list.

Does anyone in MLUG know a simple way to add a user to a group, while
leaving the user in the groups he already belongs to?

Regards,
Mark
EMAIL:PROTECTED

---------- Forwarded message ----------
From: Mark Rages <EMAIL:PROTECTED>
Date: Jan 13, 2006 11:13 PM
Subject: Re: pyk hotplug scripts and usermod
To: EMAIL:PROTECTED


On 1/13/06, Xiaofan Chen <EMAIL:PROTECTED> wrote:
>
> I was using Mark's hotplug script from pyk-0.3.1 so that I can run
> pk2 and pyk as a normal user under Linux. Then I need to
> create a group named pickit and add myself to the pickit group.
>
> So I followed the prompt and issued the cpmmand
> "usermod -G pickit mcuee" which kicks me out of all the groups
> I am in. Other than manually doing "usermod -G pickit,admin,
> audio,someothergroups mcuee", what can I do?
>
> Of course I can use the GUI to do this. But I am a bit interested
> to know how to do this using bash.
>

I would also like to know if there is a simple command to do this.

You can use 'groups' or 'id -Gn' to list the groups you are in.

So I can add 'markrages' to the 'pickit' group like this:
# usermod -G pickit,`id -Gn markrages | tr ' ' ,` markrages

The tr ' ' , is to replace spaces with commas.

But that is a hackish way to do it.  Such a common task should have a
simple command.  I will ask my Linux User Group about this.

Regards,
Mark
EMAIL:PROTECTED
--
You think that it is a secret, but it never has been one.
  - fortune cookie

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members