Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-08-2004, 12:23 PM   #1
LQ Newbie
Registered: Jan 2004
Location: Virginia
Distribution: Fedora Core 2
Posts: 27

Rep: Reputation: 15
add user to group

Hi everyone, newbie here.

I'm trying to add an existing user (don) to an existing group (admins). User don is currently a member of existing group 'dev' as well as 'don'.

I first tried the command

useradd don admins

but when I executed 'groups don', all I got was

don : don dev

So for some reason don wasn't added to admins

I then tried

usermod -Gadmins don

and, when I did 'groups don', all I got was

don : don admins

so it lost group 'dev'!

Your help please? Thanks.
Old 08-08-2004, 12:33 PM   #2
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
you can just edit /etc/group and add the user to the group you want. That's it.

Old 08-08-2004, 12:36 PM   #3
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
useradd don admins
I think this only would create a new user called "don" (and perhaps one too called "admins"?), since you only give two parametres to useradd, and looking at the manpage, parametres given without any option chars (like -G) mean login names. so that wouldn't help..

usermod -Gadmins don
this is a nasty command, I've will have to list each and every group name you wish the user be part of that you are editing. so basically you just put your user into two groups, "admins" and "don", and removed from all the others. if you use this command, first check out into which groups the user belongs already, and then list them all plus the ones you want to add...

I think the easiest way of editing groups is simply to use a text editor (nano, joe, jed etc.) and edit the actual groups file: /etc/group

just open the file, locate the right line and edit it (look the other lines for help on syntax)

EDIT: twantrd, sorry...seems like you were quick enough to answer while I was writing..
Old 08-08-2004, 04:53 PM   #4
LQ Newbie
Registered: Jan 2004
Location: Virginia
Distribution: Fedora Core 2
Posts: 27

Original Poster
Rep: Reputation: 15
Of course, editing the /etc/group file would be the easiest solution. Thanks!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
how to add a user to a new group? emanresu Linux - Newbie 5 11-21-2005 08:18 AM
how do i add user to a group jogurt666 Linux - General 2 04-02-2004 10:05 PM
how to add a user to a certain group? feetyouwell Linux - Software 2 01-13-2004 11:56 AM
how can i add a user to a group? doublefailure Linux - General 14 07-10-2002 11:11 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration