LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Really simple NIS problem (https://www.linuxquestions.org/questions/linux-networking-3/really-simple-nis-problem-630941/)

expatCM 03-27-2008 01:58 AM

Really simple NIS problem
 
I have set up the client and the server but I do not see how to use NIS.

What I am expecting is to have the same id on both client and server. What happens is that the client has one id and the server has another.

From a client if I run rpcinfo -p and rpcinfo -p nisdomain or ip I see all the necessary processes loaded.

If from the client I run ypmatch user passwd I get the server id which is what I want.

If I putty to the server and use id user I get the same id. If I run id user on the client I get the local id and I was anticipating the server id.

I think I did not do something but I do not know what that is. Can anyone tell me? Do I have to run a process to synchronize the client passwords for example?

This is on Ubuntu 7.10 if that is important.

BrianK 03-27-2008 07:34 PM

1. what does your /etc/nsswitch look like?

2. does the user in question exist in the /etc/passwd file on both the client and server?

suggestions without knowing the above:
in /etc/nsswitch, you should have something like:

Code:

passwd:        nis files
group:          nis files
shadow:        nis files

and the user should probably not exist in the client /etc/passwd.

also, be sure you "make -C /var/yp" when you add new users on the server.

Also note that after you get this working, the user will probably not be able to log into the client machine as their home dir will no longer belong to them until you straighten out the owner (it will be mapped to the old UID).

expatCM 03-27-2008 11:51 PM

Thanks for your help.

It looks like NIS only does not work where the user already exists on the client machine. If I have two users, Tom and Dick. If Tom exists on both the server and the client then I only ever get the client ID on the client. In the case of Dick who does not exist on the client then “id dick” on the client shows the server id.

(to answer your question directly, Yes the user exists in the passwd file on both the client and server)

But now I am confused. What would I do to straighten out Tom's home directory if I take him out of the client password list. Presumably I copy the home directory content to the server home directory and use NFS in order to keep all of the programs and settings for Tom working?

The nsswitch files are as follows

Server

Code:

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:        compat nis
group:          compat nis
shadow:        compat nis

hosts:            files nis dns
networks:      files

protocols:      db files
publickey        nisplus
services:      db files
ethers:        db files
rpc:            db files

netgroup:      nis

Client

Code:

# /etc/nsswitch.conf

#

# Example configuration of GNU Name Service Switch functionality.

# If you have the `glibc-doc-reference' and `info' packages installed, try:

# `info libc "Name Service Switch"' for information about this file.



passwd:        compat

group:          compat

shadow:        compat



hosts:          files mdns4_minimal [NOTFOUND=return] nis dns mdns4

networks:      files



protocols:      db files

services:      db files

ethers:        db files

rpc:            db files



netgroup:      nis db files


PDock 03-28-2008 03:13 PM

nis search not find this link
 
Digest the information found in this link which I suspect did not come up in your search on NIS

http://www.linuxquestions.org/questi...&highlight=nis

Come back with questions

ppd

BrianK 03-28-2008 04:32 PM

Quote:

Originally Posted by expatCM (Post 3102750)
Thanks for your help.

It looks like NIS only does not work where the user already exists on the client machine. If I have two users, Tom and Dick. If Tom exists on both the server and the client then I only ever get the client ID on the client. In the case of Dick who does not exist on the client then “id dick” on the client shows the server id.

(to answer your question directly, Yes the user exists in the passwd file on both the client and server)

But now I am confused. What would I do to straighten out Tom's home directory if I take him out of the client password list. Presumably I copy the home directory content to the server home directory and use NFS in order to keep all of the programs and settings for Tom working?

The nsswitch files are as follows

Server

Code:

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:        compat nis
group:          compat nis
shadow:        compat nis

hosts:            files nis dns
networks:      files

protocols:      db files
publickey        nisplus
services:      db files
ethers:        db files
rpc:            db files

netgroup:      nis

Client

Code:

# /etc/nsswitch.conf

#

# Example configuration of GNU Name Service Switch functionality.

# If you have the `glibc-doc-reference' and `info' packages installed, try:

# `info libc "Name Service Switch"' for information about this file.



passwd:        compat

group:          compat

shadow:        compat



hosts:          files mdns4_minimal [NOTFOUND=return] nis dns mdns4

networks:      files



protocols:      db files

services:      db files

ethers:        db files

rpc:            db files



netgroup:      nis db files


the nsswitch on your client is not explicitly asking to look at NIS first. This is why the local passwd file takes precedence. change it to "nis files" or at least "nis compat" & you'll always get the server UID first. That said, there's probably something more to compat, so I would do some research on that.

as far as fixing the home dir, simply change ownership of it once you're using the server's UIDs, i.e. if "id DICK" gives back the correct server UID for dick, then simply (as root):

cd /home
chown -R dick dick
chgrp -R dick dick

expatCM 03-30-2008 04:17 AM

I think the problem / solution is the order you do things.

I set my network up by getting the clients working first and then taking the server in gradual steps. This means that the user names on the client machines already exist and it would appear that with NIS you cannot have the same user name on client and server. But you cannot kill all user names on the client or you can never get in should the server not be available.

So it appears what is needed is to set up new users on the server and use those from the clients.

This seems to be a really clumsy approach but since there are many weaknesses in NIS / NFS anyway perhaps I should not be too critical ....


All times are GMT -5. The time now is 04:16 AM.