If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > /etc/group on Linux

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,361
/etc/group on Linux

This is a general Linux question:

$ id db2inst1
uid=1512(db2inst1) gid=1505(db2iadm1) groups=1505(db2iadm1),1508(candle)

$ groups db2inst1
db2inst1 : db2iadm1 candle

$ more /etc/passwd | grep 1505
db2inst1:x:1512:1505::/xxx/db2/db2inst1:/bin/bash

$ more /etc/group | grep db2iadm1
db2iadm1:x:1505:


/etc/group doesn't list db2inst1 being part of db2iadm1. Does anyone know why it's this way on Lunux? Does it have to do with how the user/group was created or this is just a Linux thing?
Reply With Quote
  #2 (permalink)  
Old
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,361
Just found one Linux server (one out of many) where the primary group of a user in present in /etc/group.

Example:

~> more /etc/group | grep db2
db2iadm1:!:1008:
db2fadm1:!:1007:db2fenc1


~> id db2inst1; id db2fenc1
uid=2006(db2inst1) gid=1008(db2iadm1) groups=1001(candle),1008(db2iadm1)
uid=2007(db2fenc1) gid=1007(db2fadm1) groups=1007(db2fadm1)



Another server shows:

~> more /etc/group | grep db2
db2iadm1:!:1008:
db2fadm1:!:1007:


~> id db2inst1; id db2fenc1
uid=1502(db2inst1) gid=1008(db2iadm1) groups=1001(candle),1008(db2iadm1)
uid=1503(db2fenc1) gid=1007(db2fadm1) groups=1007(db2fadm1)



Both servers are zLinux:

/etc/SuSE-release:
SUSE Linux Enterprise Server 10 (s390x)
VERSION = 10
PATCHLEVEL = 4


Anyone knows why?
Reply With Quote
  #3 (permalink)  
Old
Programming since 1BC
 
Join Date: Sep 2009
Location: Ontario
Posts: 971
I'd be suspect of the machine that is different if it is the only one.
The two machines I checked, both SuSE 11.2, showed as you would expect.
Reply With Quote
  #4 (permalink)  
Old
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,361
I've done some reading since posting my question. Based on my understanding, on Linux: the primary group info is stored in /etc/passwd and the secondary group info in /etc/group. So, I should only see my secondary groups listed in /etc/group. But what I'm not sure about is why some user's primary group appear in /etc/group and some don't.

Example:

$ id vjxxxx
uid=1511(vjxxxx) gid=1509(staff) groups=1509(staff),1510(sysgrp)

$ id bkxxxx
uid=1507(bkxxxx) gid=1509(staff) groups=1509(staff),1510(sysgrp)

$ more /etc/group | grep staff
staff:x:1509:bkxxxx


The primary group of vjxxxx and bkxxxx is staff; however, /etc/group contains bkxxxx but not vjxxxx.



If I create a new user on this server (RHEL 5.8) , I don't see it in /etc/group:


# groupadd -g 777 db2g

# more /etc/group | grep db2g
db2g:x:777:

# useradd -g db2g db2u

# id db2u
uid=1513(db2u) gid=777(db2g) groups=777(db2g)

# more /etc/group | grep db2g
db2g:x:777:


Oh, well... I just have to remember that Linux is different from AIX when it comes to /etc/group.
Reply With Quote
  #5 (permalink)  
Old
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 5,376
Looking at the Red Hat Linux, I suspect that the primary group membership does not show in /etc/groups. Only if you explicitly do "usermod -G db2g db2u", setting db2g as a supplementary group, will db2u show in /etc/group for db2g.

I don't have an AIX box to check if it's different there.
__________________
---
"It does not work" is not a valid problem statement.
Reply With Quote
  #6 (permalink)  
Old
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by n_i View Post
Only if you explicitly do "usermod -G db2g db2u", setting db2g as a supplementary group, will db2u show in /etc/group for db2g.
Bingo! Thank you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On