Results 1 to 6 of 6
  1. #1
    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?

  2. #2
    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?

  3. #3
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,004
    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.

  4. #4
    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.

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,429
    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.

  6. #6
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •