A netgroup defines a network-wide group of hosts and users. Use a netgroup to restrict access to shared NFS filesystems and to restrict remote login and shell access.
Network groups are stored in a network information services, such as LDAP, NIS, or NIS+, not in a local file.
Netgroup are a great way to identify people and machines under nice, neat names for access control. A good example of using this feature is for a site where users are not allowed to log in to server machines. You can create a netgroup for the system administrators and let in members of the group through a special entry in the /etc/passwd file.
Netgroup have become a daily staple for NIS administrators. They allow machines and/or users to be collected together for various administrative tasks such as grouping machines together for use in the tcp_wrappers files /etc/ hosts .allow and /etc/hosts.deny . In this next example, you restrict access via ssh only to members of the sysadmin Netgroup:
# /etc/hosts.deny sshd: ALL . . . # /etc/hosts.allow sshd: @sysadmin
These are just a few of the excellent uses for NIS netgroups. If we take this functionality and implement an LDAP based backend, we can not only take advantage of these tools but gain the security, manageability and fault tolerance of Fedora Directory Server.
Before adding any Netgroup entries to the directory, you must create a container where Netgroups are located. By convention, the ou=netgroup organizational unit is often used for storing Netgroup:
dn: ou=netgroup,dc=willeke,dc=com objectclass: organizationalUnit ou: netgroup
the sysadmin netgroup could be represented by this LDIF entry:
dn: cn=sysadmin,ou=netgroup,dc=plainjoe,dc=org objectClass: nisNetgroup objectClass: top cn: sysadmin nisNetgroupTriple: (garion.plainjoe.org,,) nisNetgroupTriple: (silk.plainjoe.org,,)
## /etc/nsswitch.conf ## . . . netgroup: ldap
getent netgroup sysadmin sysadmin (sa.willeke.com, , ) (xenhost.willeke.com, , )
The format of a netgroups file is as follows:
groupname member-list
groupname is the name of the group being defined, and the member-list consists of other group names or tuples of specific data. Each entry in the member-list is separated by a whitespace.
(hostname, username, domain name)
(technics,,)implies everybody on the host technics.
An entry with a dash in it (-) means that there are no valid values for that entry. For example,
(-,sshah,)Here we imply the user sshah and nothing else. This is useful for generating a list of users or machine names for use in other netgroups. NOTE: We recommend that the format to be used is:
(,sshah,)We have seen some implementations that do not like the use of the "-" for none.
(,sshah,) (,heidis,)permission to log in to a server, you add this line to your /etc/passwd file:
+@sysadmins
An example of a full netgroups file follows:
sysadmins (,sshah,) (,heidis,) (,jnguyen,) (,mpham,) servers (numark,,) (vestax,,) clients (denon,,) (technics,,) (mtx,,) research-1 (,boson,) (,jyom,) (,weals,) (,jaffe,) research-2 (,sangeet,) (,mona,) (,paresh,) (,manjari,) (,jagdish,) consultants (,arturo,) allusers sysadmins research-1 research-2 consultants allhosts servers clients