LinuxQuestions.org
Have you listened to LQ Radio?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices

Reply
 
Thread Tools
Old 11-25-2005, 08:42 AM   #1
steady_lfcfan
LQ Newbie
 
Registered: Oct 2004
Posts: 2
Thanked: 0
How to list user in Linux box, add an user to a group!


[Log in to get rid of this advertisement]
I have found for time but i still don' know how to list the user in my linux box, also how can I add an exist user to a group!
steady_lfcfan is offline     Reply With Quote
Old 11-25-2005, 09:26 AM   #2
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388
Thanked: 0
To list the users:

cat /etc/passwd | cut -d":" -f1

Hmm, not sure about how to add an existing user to a group though.
trevelluk is offline     Reply With Quote
Old 11-25-2005, 09:38 AM   #3
pingu
Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 553
Thanked: 0
Depending on distro and desktop, you probably have several gui's to choose from.
Search the menu, or systems control-center (if any), or kde's controlcenter.

Or do it the manual way:
List users:
# cat /etc/passwd
Add user to a group: edit /etc/group Syntax is:
cdrom:x:22eterh,charles

The user of course has to exist or you'll have problems...

Command-line tools:
useradd and groupadd
pingu is offline     Reply With Quote
Old 11-25-2005, 08:29 PM   #4
steady_lfcfan
LQ Newbie
 
Registered: Oct 2004
Posts: 2
Thanked: 0

Original Poster
Re: How to list user in Linux box, add an user to a group!

Quote:
Originally posted by steady_lfcfan
I have found for time but i still don' know how to list the user in my linux box, also how can I add an exist user to a group!

thank you, but this print all user includes system user (samba,apache ...)

Pingu, I am running Radhat box and I have not X installed, is there other way?
steady_lfcfan is offline     Reply With Quote
Old 11-26-2005, 12:30 AM   #5
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 5.0.3 (lenny)
Posts: 899
Thanked: 0
See if this helps.
jrdioko is offline     Reply With Quote
Old 11-26-2005, 12:51 AM   #6
syg00
Guru
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 6,908
Thanked: 165
Re: How to list user in Linux box, add an user to a group!

Quote:
Originally posted by steady_lfcfan
... also how can I add an exist user to a group!
"usermod -G ..." ???
See the manpage.
syg00 is offline     Reply With Quote
Old 01-16-2008, 08:12 AM   #7
fr4X
LQ Newbie
 
Registered: Jan 2008
Posts: 1
Thanked: 0
well I see many answered to the listing users,but not so clear answers to adding an existing user to a group (no offense); you can do this by using the "gpasswd -a user group" command.



I know my answer is only a few years late but for googling people it might be nice

Last edited by fr4X; 01-16-2008 at 08:14 AM..
fr4X is offline     Reply With Quote
Old 01-23-2008, 02:46 AM   #8
B-Con
LQ Newbie
 
Registered: Jan 2008
Posts: 1
Thanked: 0
As long as the thread got drug up...

Quote:
Originally Posted by syg00 View Post
"usermod -G ..." ???
See the manpage.
That's dangerous, since it will REMOVE the user from all current groups and put them ONLY in the specified groups.
Quote:
Originally Posted by manpage
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
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. This behaviour can be changed via the -a
option, which appends the user to the current supplementary group
list.
Be sure to do -aG, not just -G.
B-Con is offline     Reply With Quote
Old 07-26-2009, 12:54 PM   #9
bdeank
LQ Newbie
 
Registered: Jul 2009
Posts: 1
Thanked: 0
Listing Groups

For those following along at home, listing groups can be accomplished in the same way as users:

Code:
cat /etc/group | cut -d":" -f1
bdeank is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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 add a user to a new group? emanresu Linux - Newbie 5 11-21-2005 09:18 AM
add user to the group ashley75 Linux - General 4 03-30-2005 03:42 PM
how do i add user to a group jogurt666 Linux - General 2 04-02-2004 11:05 PM
how to add a user to a certain group? feetyouwell Linux - Software 2 01-13-2004 12:56 PM
how can i add a user to a group? doublefailure Linux - General 14 07-10-2002 12:11 PM


All times are GMT -5. The time now is 04:47 AM.

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