Linux – NIS authorization and adding existing user

centoslinuxnis

Recently i have apply NIS in our testing environment in order to get more control and centralized password management for user in the server.But when I'm finished implementing the NIS,I'm facing some issues.The issues are :

1.How to add existing user into NIS?
For example,Let say I have two servers named NIS server and NIS client.If there are existing user in NIS client,can we add it to NIS map in NIS server?or do we need to create these user manually? I can manually add the credential for the user manually but it is not convenient for me to write again all hundred of the users in the system.

2.Is there any way to devide the user to several group?
We want to restrict some user to only access some server.Could we do that in NIS?

I've tried to do some research regarding this issue,but it seems that there are lacking documentation for NIS in centos.Any help really appreciated.Thanks.

Best Answer

1.How to add existing user into NIS?

You add the user to the appropriate passwd file on the NIS server. This may be /etc/passwd on the server, but it may also be another location depending on your configuration. If a user exists on a client system and you want to add them to the global NIS account database, you will probably need to:

  • Remove them from the client.
  • Add them on the server.
  • Rebuild and push your NIS maps.

I can manually add the credential for the user manually but it is not convenient for me to write again all hundred of the users in the system.

Assuming unique usernames and user ids, you could just concatenate all your passwd files together, strip out the system accounts, and add them to your NIS server. If your clients are using shadow passwords (/etc/shadow) you'll need to extract those, too.

2.Is there any way to devide the user to several group? We want to restrict some user to only access some server.Could we do that in NIS?

Sure, NIS offers groups similar in function and behavior to your local /etc/groups file. Just add the users to the appropriate groups in the groups source file on the NIS server, then rebuild and push your maps.