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 02-01-2013, 06:50 PM   #1
Registered: Dec 2004
Posts: 40

Rep: Reputation: 15
Question 'groups' command does not show my newGroup in CENTOS

I created a new group in CentOS but when i type 'groups' I don't see the new group. So here is what I did

[root@james]# groupadd newgroup
[root@james]# usermod -G newgroup mary
[root@james]# groups
[root@james]# james users

I was hoping to see a list like this:
[root@james]# james users newgroup

Where is my new group called newgroup? In redhat linux I usually just type groups and it shows me all the groups.

When I use the command below I do see the group and its user.
[root@james]# getent group newgroup
[root@james]# newgroup:x:503:mary

What am I doing wrong?

Thank you
Old 02-01-2013, 06:51 PM   #2
Senior Member
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Does the command 'id' show your groups? If you look at the /etc/groups file and the /etc/passwd file do you actually see your user associated with the GID?

Last edited by Kustom42; 02-01-2013 at 06:53 PM. Reason: Overlooked the output provided by OP,
Old 02-01-2013, 09:51 PM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
As per manual of groups cmd, there should be username as argument:
     groups [ user ... ]
Else it will return groups of logged in user, not the groups of any other user like mary.
[root@james]# groups        ## It will return groups of root
[mary@james]# groups        ## It will return groups of mary
So in order to check groups of user mary, when logged in as root, do:
[root@james]# groups mary
Alternatively, it's better to use id cmd:
[root@james]# id -a username
[root@james]# id -a mary
It will not only return groups but corresponding group ids as well.
Old 02-02-2013, 12:33 AM   #4
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
Did you logout and login after you changed the group?
Old 02-02-2013, 01:10 PM   #5
Registered: Dec 2004
Posts: 40

Original Poster
Rep: Reputation: 15

logged out and logged back and typed I can see the my new group.

[root@james]# groups mary
shows me the group mary belongs to. I have to try to remember that. Is the behavious of the 'groups' command in RHL the same as in CentOS? Just curious.

Thank you everyone!


Last edited by ceci2; 02-02-2013 at 01:11 PM.
Old 02-03-2013, 07:29 PM   #6
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Yes; groups is a fairly std cmd AND Centos is a free rebuild of RHEL


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
What command to show Centos version running zapo Linux - Newbie 8 03-24-2010 09:45 PM
Getent passwd dont show AD Groups and Users adrigo Linux - Server 6 08-13-2009 01:14 PM
Command 'groups' doesn't show group membership correctly Akhran Debian 1 03-14-2006 07:16 AM
Best Newgroup Readers For Suse oldtrout Linux - Newbie 3 12-09-2004 11:47 AM
Samba/wbinfo doesn't show local groups pauljtester Linux - Networking 1 09-05-2004 08:26 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:36 AM.

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