AllowGroups @admins DenyGroups @contractors Then ssh -v will check the netgr map before granting a login. In /etc/exports :
/home @engineering(rw,sync) @marketing(ro) *(noaccess) The NFS server queries netgr to decide which netgroup gets read-write access. all_employees sales_dev marketing_dev hr_dev sales_dev (srv-sales, -, ) (srv-crm, -, ) Nesting allows scalable hierarchies—change one sub-group and every parent inherits. Troubleshooting Common netgr Issues Problem 1: ypcat netgroup returns nothing Solution: Ensure the map exists: make netgroup and check /var/yp/domainname/netgroup.dir . Problem 2: Login fails even though user is in netgr Solution: Check for trailing spaces or commas. Syntax is strict: no spaces inside parentheses. ✔ Correct: (server1,user1,) ✘ Wrong: ( server1, user1, ) Problem 3: Netgroups not resolving in /etc/nsswitch.conf Solution: Run getent netgroup admins . If empty, reorder nsswitch: netgroup: nis [NOTFOUND=return] files . Migrating from NIS netgr to LDAP Modern environments replace netgr with RFC 2307bis schema. The attribute nisNetgroupTriple stores the same triple format. Use migrationtools to convert: xxx netgr
admins ( -, alice, ) ( -, bob, ) workstations ( ws01, -, ) ( ws02, -, ) devops admins workstations Empty fields act as wildcards. ( -, alice, ) means Alice can log in from any host. Step 2: Update NIS maps cd /var/yp make netgroup This generates the netgr map (often named netgroup.byname and netgroup.byhost ). Step 3: Client-side configuration On each NIS client, edit /etc/nsswitch.conf : AllowGroups @admins DenyGroups @contractors Then ssh -v will
However, after reviewing multiple databases, technical glossaries, and common search engine trends, in technology, networking, software development, or general English language. ✔ Correct: (server1,user1,) ✘ Wrong: ( server1, user1,
netgroup: nis files 1. Restricting SSH Access via netgr In /etc/ssh/sshd_config :