Switch Action Options
You can instruct the switch to respond to status messages with either of the
two actions shown in the following table.
Table 2-3 Responses to Switch Status Messages
Action | Meaning |
return | Stop looking for the information. |
continue | Try the next source. |
Default Search Criteria
The combination of nsswitch.conf file status message and action option determines what the routine does at each step. The combination of status and action make
up the search criteria.
The switch's default search criteria are the same for every source. As described in terms of the status messages listed above, see the following.
SUCCESS=return. Stop looking for the information. Proceed using the information that has been found.
UNAVAIL=continue. Go to the next nsswitch.conf file source and continue searching. If this source is the last or only source, return with a NOTFOUND status.
NOTFOUND=continue. Go to the next nsswitch.conf file source and continue searching. If this source is the last or only source, return with a NOTFOUND status.
TRYAGAIN=continue. Go to the next nsswitch.conf file source and continue searching. If this source is the last or only source, return with a NOTFOUND status.
You can change default search criteria by explicitly specifying some other criteria by using the STATUS=action syntax shown above. For example, the default action for a NOTFOUND condition is to continue the search to the next source. For example,
to specify for networks, the search should stop in a NOTFOUND condition, edit the networks line of the switch file. The
line would read as follows.
networks: nis [NOTFOUND=return] files
|
The networks: nis [NOTFOUND=return] files line specifies a non-default criterion for the NOTFOUND status. Non-default criteria are delimited by square brackets.
In this example, the search routine behaves as follows:
If the networks map is available, and contains the needed information, the routine returns with a SUCCESS status message.
If the networks map is not available, the routine returns with an UNAVAIL status message. By default, the routine continues to search the appropriate /etc file.
If the networks map is available and found, but the map does not contain the needed information, the routine returns with a NOTFOUND message. But, instead of continuing on to search the appropriate /etc file, which would
be the default behavior, the routine stops searching.
If the networks map is busy, the routine returns with an TRYAGAIN status message and by default continues on to search the appropriate /etc file.
What if the Syntax is Wrong?
Client library routines contain compiled-in default entries
that are used if an entry in the nsswitch.conf file is either missing or syntactically incorrect. These entries are the same as the switch file's defaults.
The name service switch assumes that the table and source names are spelled correctly. If you misspell a table or source name, the switch uses default values.
Auto_home and Auto_master
The switch search criteria for the auto_home and auto_master tables and maps is combined into one category, which is called automount.
Timezone and the Switch File
The timezone table does not use the switch, so the table is not included in the switch file's list.
Comments in nsswitch.conf Files
Any nsswitch.conf file line beginning with a comment character (#) is interpreted as a comment line. A comment line is ignored by routines that
search the file.
Characters preceding a comment mark are interpreted by routines that search the nsswitch.conf file. Characters to the right of the comment mark are interpreted as comments and ignored.
Table 2-4 Switch File Comment Examples
Type of Line | Example |
Comment line. | # hosts: nisplus [NOTFOUND=return] files |
Interpreted line. | hosts: nisplus [NOTFOUND=return] file |
Partially interpreted line. The files element is not interpreted. | hosts: nisplus [NOTFOUND=return] # files |
Keyserver and publickey Entry in the Switch File
Caution - You must restart the keyserver after you make a change to nsswitch.conf.
The keyserver reads the publickey entry in the name service switch configuration file only when the keyserver is started. If you change the switch configuration file, the keyserver does not
register the changes until the keyserver is restarted.
The nsswitch.conf Template Files
Four switch template files are provided with the Solaris operating environment to accommodate different naming services. Each file provides a different default set of information sources.
The four template files are the following.
LDAP template file. The nsswitch.ldap configuration file specifies the LDAP directory as the primary source of information for the machine.
Note - In order to use LDAP naming services, you must also properly configure all LDAP client machines, in addition to modifying the nsswitch.conf. See Chapter 16, Setting Up Clients (Tasks) for more information.
NIS+ template file. The nsswitch.nisplus configuration file specifies NIS+ as the primary source for all information except passwd, group, automount, and aliases. For
those four files, the primary source is local /etc files. The secondary source is an NIS+ table. The [NOTFOUND=return] search criterion instructs the switch to stop searching the NIS+ tables if the switch gets a "No such entry" message. The
switch searches through local files only if the NIS+ server is unavailable.
NIS template file. The nsswitch.nis configuration file is almost identical to the NIS+ configuration file, except that NIS file specifies NIS maps in place of NIS+ tables. Because the search order for passwd and group is files nis,
you don't need to place the + entry in the /etc/passwd and /etc/group files.
Files template file. The nsswitch.files configuration file specifies local /etc files as the only source of information for the machine. There is no "files" source for netgroup, so the client
does not use that entry in the switch file.
Copy the template file that most closely meets your requirements to the nsswitch.conf configuration file and then modify the file as needed.
For example, to use the LDAP template file, you would type the following command.
mymachine# cp /etc/nsswitch.ldap /etc/nsswitch.conf
|
The Default Switch Template Files
The following is the four switch files which are supplied with Solaris operating environment.
Example 2-1 NIS+ Switch File Template: nsswitch.nisplus
#
#
# /etc/nsswitch.nisplus:
#
#
# An example file that could be copied over to /etc/nsswitch.conf;
# it uses NIS+ (NIS Version 3) in conjunction with files.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet"
# transports.
# the following two lines obviate the "+" entry in /etc/passwd
# and /etc/group.
passwd: files nisplus
group: files nisplus
# consult /etc "files" only if nisplus is down.
hosts: nisplus [NOTFOUND=return] files
# Uncomment the following line, and comment out the above, to use
# both DNS and NIS+. You must also set up the /etc/resolv.conf
# file for DNS name server lookup. See resolv.conf(4).
# hosts: nisplus dns [NOTFOUND=return] files
services: nisplus [NOTFOUND=return] files
networks: nisplus [NOTFOUND=return] files
protocols: nisplus [NOTFOUND=return] files
rpc: nisplus [NOTFOUND=return] files
ethers: nisplus [NOTFOUND=return] files
netmasks: nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files
publickey: nisplus
netgroup: nisplus
automount: files nisplus
aliases: files nisplus
sendmailvars: files nisplus
|
|