• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Monday, April 14, 2014

    How to find/view all the members of a group in Linux

    Now in Linux we have two types of groups
    • Primary Group
    • Secondary Group

    View all the members of the primary group

    First you need to know the GID of the group of whoose members you want to query for

    # grep "group_name" /etc/group
    # grep dba /etc/group

    Now grep that GID to get list of users under dba group
    # grep 503 /etc/passwd

    View all the members of the secondary group

    To do this we have a no. of methods

    Method 1
    # getent group dba

    Method 2
    # grep dba /etc/group

    Method 3
    # groupmems -g "group_name" -l
    # groupmems -g dba -l
    deepak  deep  user  user1

    Related Articles
    How to create password less ssh connection for multiple non-root users
    How to create user without useradd command in Linux
    How to give normal user root privileges using sudo in Linux/Unix
    How to give permission to user to run some commands in Linux

    Follow the below links for more tutorials

    What is the difference/comparison between Unix and Linux ?
    What are the maximum and minimum limits for RHEL 4 vs 5 vs 6 ?
    RAID levels 0, 1, 2, 3, 4, 5, 6, 0+1, 1+0 features explained in detail


    Post a Comment