LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-01-2013, 05:50 PM   #1
ceci2
Member
 
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, 05:51 PM   #2
Kustom42
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 05:53 PM. Reason: Overlooked the output provided by OP,
 
Old 02-01-2013, 08:51 PM   #3
shivaa
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:
Code:
SYNOPSIS
     groups [ user ... ]
Else it will return groups of logged in user, not the groups of any other user like mary.
Code:
[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:
Code:
[root@james]# groups mary
Alternatively, it's better to use id cmd:
Code:
[root@james]# id -a username
[root@james]# id -a mary
It will not only return groups but corresponding group ids as well.
 
Old 02-01-2013, 11:33 PM   #4
gdejonge
Member
 
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, 12:10 PM   #5
ceci2
Member
 
Registered: Dec 2004
Posts: 40

Original Poster
Rep: Reputation: 15
Resolved

logged out and logged back and typed groups...now 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!

Ceci

Last edited by ceci2; 02-02-2013 at 12:11 PM.
 
Old 02-03-2013, 06:29 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Yes; groups is a fairly std cmd http://linux.die.net/man/1/groups AND Centos is a free rebuild of RHEL
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration