Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We use NIS to allow all our users to connect to any of our hosts. However, for one particular host, I want to restrict the users that can log in to a subset of the NIS users.

Is this possible?

share|improve this question
up vote 3 down vote accepted

Yes, you can setup a netgroup and only place the users you want in that netgroup. Then on the host server that you want to restrict access you modify your nsswitch.conf accordingly and then place the netgroup in your /etc/passwd and /etc/shadow. ie:


I've done this before but can't quiet recall all the specifics. But netgroups is definitely the way you want to go. Netgroups also work well in LDAP for this purpose, if you ever decide to migrate to it some day.

Keep in mind the approach for Linux vs. Unix may differ slightly.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.