Operating System - HP-UX
1832279 Members
2265 Online
110041 Solutions
New Discussion

NSSWITCH.CONF service file clarification

 
SOLVED
Go to solution
Norman Dignard
Regular Advisor

NSSWITCH.CONF service file clarification

Just want someone to clarify a few things from what I read in the man pages and docs.

1. In the nsswitch file - do do need all default 11 entries or can this file be trimmed down to say just
passwd and group name services?

2. According to the man pages for nsswitch.conf:

For each status code, two actions are possible:
Action Meaning
continue Try the next source in the list
return Return now
EG. The policy "nis [NOTFOUND=return] files" implies "if nis is UNAVAIL, continue on to files, and if nis returns NOTFOUND, return to the caller; in other words, treat nis as the authoritative source of information and try files only if nis is down."

But the HP Instant Info, Installing and Admin of NFS Services, Chptr 6 - Configuring the Name service Switch says:

Action Meaning
continue Try the next name service in the list
return End the lookup and return control to the calling process without consulting the next name service in the list.

So which is it ??? Does the following entry:
hosts: nis [NOTFOUND=return] dns [NOTFOUND=return] files
abort if nis not found or continue the lookup to dns and if not found then look at files?

Norm Dignar
5 REPLIES 5
Uday_S_Ankolekar
Honored Contributor

Re: NSSWITCH.CONF service file clarification

Hi,
As far as I know this file contains a configuration that will cause for example
hosts: nis [NOTFOUND=continue] files

This measns hosts to use NIS first then /etc/hosts, if NIS is either not up and running, or does not contain any answer in the NIS maps It's checkes the entries sequentially. If First entry doesn't give the answer then look for next entry.

Your nsswitch.conf file may contain only the services you needed.

-USA..
Good Luck..
Mark van Hassel
Respected Contributor

Re: NSSWITCH.CONF service file clarification

hosts: nis [NOTFOUND=return] dns [NOTFOUND=return] files
abort if nis not found or continue the lookup to dns and if not found then look at files?


If NIS returns "NOTFOUND" the lookup returns to the caller. If NIS for example is UNAVAILABLE (when nis is not available) or when it is busy (TRYAGAIN) the lookup will continue with DNS and if that returns a code any other than NOTFOUND it continues onward with files.


HtH,

Mark
The surest sign that life exists elsewhere in the universe is that none of it has tried to contact us
Sanjay_6
Honored Contributor

Re: NSSWITCH.CONF service file clarification

Hi Norman,

To answer to your first question, you can trim down the nsswitch.conf file o include only those entries you want.

To the second question, the behavior is controlled by the policy. There are four parameters involved with each lookup option in an entry. They are "SUCCESS", "NOTFOUND", "UNAVAIL" & "TRYAGAIN". Try these two links for more info,

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90685/B2355-90685_top.html&con=/hpux/onlinedocs/B2355-90685/00/00/8-con.html&toc=/hpux/onlinedocs/B2355-90685/00/00/8-toc.html&searchterms=nsswitch.conf&queryid=20020206-091735

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B1031-90048/B1031-90048_top.html&con=/hpux/onlinedocs/B1031-90048/00/00/35-con.html&toc=/hpux/onlinedocs/B1031-90048/00/00/35-toc.html&searchterms=nsswitch.conf&queryid=20020206-091916

Hope this helps.

Regds
James R. Ferguson
Acclaimed Contributor
Solution

Re: NSSWITCH.CONF service file clarification

Hi Norman:

Remember that the default action is to "continue" unless otherwise specified. Don't confuse the "UNAVAILable" status which means "not responding" with the "NOTFOUND" status which is a positive response meaning "no such entry".

The man pages note that the default criteria are to 'continue' on anything except SUCCESS; in other words, [SUCCESS=return NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue].

Thus your entry:

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

...would skip 'nis' and 'dns' if they were not not configured and proceed to examine /etc/hosts. If, however, 'dns' was configured, but not providing a response, then /etc/hosts would be consulted. If 'dns' responded "no such entity", then that would be the definitive answer and control would return to the caller without looking at /etc/hosts.

Regards!

...JRF...



Dmitry G. Spitsyn
Trusted Contributor

Re: NSSWITCH.CONF service file clarification

Hello, Norman !
The nsswitch.conf file is a configuration file for NSS-library on HP-UX.
You can find out a default NSS behavior (if there is no nsswitch.conf file in /etc) of your current HP-UX version by referencing /etc/nsswitch.hp_default file. There are several sample NSS configuration files in /etc named nsswitch.files, nsswitch.nis etc. You can use one of them as a template for the nsswitch.conf according to your requirements.
BR,
DGS.