This is a discussion on How do I add an existing user to a group? within the Linux Security forums, part of the System Security and Security Related category; When I added the user with useradd, I put him in a single group with the -g option. Now, I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
When I added the user with useradd, I put him in a single group with
the -g option. Now, I want to add the user to several more groups. What linux command is used to do this? And, can I add user to more than a single group in a single instance of the command? Thx - am new at this - fully appreciate all assistance. |
|
|||
|
On Mon, 21 Mar 2005 22:24:50 -0500, MLH wrote:
> When I added the user with useradd, I put him in a single group with > the -g option. Now, I want to add the user to several more groups. > What linux command is used to do this? And, can I add user to more > than a single group in a single instance of the command? > > Thx - am new at this - fully appreciate all assistance. to modify an existing users groups (to add them to more groups ) usermod -G <new group> to do this during the creation of an account useradd -G <extra group> HTH -- Hardware, n.: The parts of a computer system that can be kicked |
|
|||
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Shane (aka froggy) wrote: > On Mon, 21 Mar 2005 22:24:50 -0500, MLH wrote: > > >>When I added the user with useradd, I put him in a single group with >>the -g option. Now, I want to add the user to several more groups. >>What linux command is used to do this? And, can I add user to more >>than a single group in a single instance of the command? >> >>Thx - am new at this - fully appreciate all assistance. > > > to modify an existing users groups (to add them to more groups ) > usermod -G <new group> Caveat: the argument -G takes a list of groups, and uses that list to /replace/ the supplemental group list that your user currently has. If you just -G the new group, the user will lose membership in all other supplemental groups. See the usermod(8) manpage for details - look for the -G description that reads -G group,[...] A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option. If the user is ============== currently a member of a group which is not listed, ========================================***======= = the user will be removed from the group =================*******=============== > to do this during the creation of an account > useradd -G <extra group> Similarly, the useradd(8) -G option lists /all/ the supplemental groups that the user belongs to. Miss one, and you will have to usermod(8) the user to add the group in later. - -- Lew Pitcher Master Codewright & JOAT-in-training | GPG public key available on request Registered Linux User #112576 (http://counter.li.org/) Slackware - Because I know what I'm doing. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCQOqKagVFX4UWr64RAnh0AJ98ADbgtC9XBzL4N6NO7C 2YVAXpDACg52LF MXQhwP5RlnV0rP+wzNYB8p0= =BDUo -----END PGP SIGNATURE----- |
|
|||
|
MLH wrote:
> When I added the user with useradd, I put him in a single group with > the -g option. Now, I want to add the user to several more groups. > What linux command is used to do this? And, can I add user to more > than a single group in a single instance of the command? > > Thx - am new at this - fully appreciate all assistance. The easy way is to use the gpasswd command. See the man page. -Wayne |