Solaris システムでは、さまざまなネームサービスに対応できるように、スイッチテンプレートファイルが 4 つ用意されています。ファイルごとに、異なるデフォルトの情報ソースセットが提供されます。
4 つのテンプレートファイルは、次のとおりです。
LDAP テンプレートファイル。nsswitch.ldap 構成ファイルでは、マシンの情報の一次ソースとして LDAP ディレクトリが指定されています。
LDAP ネームサービスを使用するには、すべての LDAP クライアントマシンを正しく設定し、nsswitch.conf を変更する必要があります。詳細は、第 12 章LDAP クライアントの設定 (手順)を参照してください。
NIS+ テンプレートファイル。nsswitch.nisplus 構成ファイルでは、passwd、group、automount、aliases を除くすべての情報の一次ソースとして NIS+ が指定されています。これら 4 つのファイルでは、一次ソースはローカルの /etc ディレクトリのファイルで、二次ソースは NIS+ テーブルです。[NOTFOUND=return] という検索基準は、スイッチが「No such entry」というメッセージを受け取ったら NIS+ テーブルの検索を停止するという意味です。スイッチは、NIS+ サーバーを使用できない場合のみ、ローカルファイルを検索します。
NIS テンプレートファイル。nsswitch.nis 構成ファイルでは、passwd、group、automount、aliases を除くすべての情報の一次ソースとして NIS が指定されています。これら 4 つのファイルでは、一次ソースはローカルの /etc ディレクトリのファイルで、二次ソースは NIS マップです。[NOTFOUND=return] という検索基準は、スイッチが「No such entry」というメッセージを受け取ったら NIS マップの検索を停止するという意味です。スイッチは、NIS サーバーを使用できない場合のみ、ローカルファイルを検索します。
passwd、group の情報に関しては files nis という順序で検索するよう指定されているため、/etc/passwd と /etc/group に + エントリを指定する必要はありません。
files テンプレートファイル。nsswitch.files では、マシンの情報ソースとしてローカルの /etc ディレクトリのファイルだけが指定されています。netgroup に関する files のソースは存在しないため、クライアントがスイッチファイルでこのエントリを使用することはありません。
要件に一番近いテンプレートファイルを nsswitch.conf 構成ファイルにコピーして、必要に応じてファイルを変更します。
たとえば、LDAP テンプレートファイルを使用する場合は、次のコマンドを入力します。
mymachine# cp /etc/nsswitch.ldap /etc/nsswitch.conf |
Solaris 製品で用意されているスイッチファイルは、次のとおりです。
# # # /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 |
publickey エントリでは、nisplus を値のリストの先頭にしてください。たとえば、publickey: nisplus files が、複数の NIS+ ドメインから参照される nsswitch.conf ファイルの正しいエントリです。
# # /etc/nsswitch.nis: # # An example file that could be copied over to /etc/nsswitch.conf; # it uses NIS (YP) 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 nis group: files nis # consult /etc "files" only if nis is down. hosts: nis [NOTFOUND=return] files networks: nis [NOTFOUND=return] files protocols: nis [NOTFOUND=return] files rpc: nis [NOTFOUND=return] files ethers: nis [NOTFOUND=return] files netmasks: nis [NOTFOUND=return] files bootparams: nis [NOTFOUND=return] files publickey: nis [NOTFOUND=return] files netgroup: nis automount: files nis aliases: files nis # for efficient getservbyname() avoid nis services: files nis sendmailvars: files |
# # /etc/nsswitch.files: # # An example file that could be copied over to /etc/nsswitch.conf; # it does not use any naming service. # # "hosts:" and "services:" in this file are used only if the # /etc/netconfig file has a "-" for nametoaddr_libs of "inet" # transports. passwd: files group: files hosts: files networks: files protocols: files rpc: files ethers: files netmasks: files bootparams: files publickey: files # At present there isn't a 'files' back end for netgroup; # the system will figure it out pretty quickly, and will notuse # netgroups at all. netgroup: files automount: files aliases: files services: files sendmailvars: files |
# # /etc/nsswitch.ldap: # # An example file that could be copied over to /etc/nsswitch.conf; it # uses LDAP 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 ldap group: files ldap hosts: ldap [NOTFOUND=return] files networks: ldap [NOTFOUND=return] files protocols: ldap [NOTFOUND=return] files rpc: ldap [NOTFOUND=return] files ethers: ldap [NOTFOUND=return] files netmasks: ldap [NOTFOUND=return] files bootparams: ldap [NOTFOUND=return] files publickey: ldap [NOTFOUND=return] files netgroup: ldap automount: files ldap aliases: files ldap # for efficient getservbyname() avoid ldap services: files ldap sendmailvars: files |
Solaris ソフトウェアと共にインストールされるデフォルトの nsswitch.conf ファイルは、インストール時に選択したネームサービスで決まります。ファイルの各行は、ネットワーク情報の種類 (ホスト、パスワード、グループなど) と、それに対する情報ソース (NIS+ テーブル、NIS マップ、DNS ホストテーブル、同一マシン上の /etc など) を対応させています。ネームサービスを選択すると、そのサービスのスイッチテンプレートファイルがコピーされ新しい nsswitch.conf ファイルが作成されます。たとえば、NIS を選択した場合は、nsswitch.nis ファイルがコピーされ新しい nsswitch.conf ファイルが作成されます。
nsswitch.conf ファイルは、次の代替 (テンプレート) バージョンと一緒に、Solaris 9 リリースソフトウェアによって各マシンの /etc ディレクトリに自動的にロードされます。
これらの代替テンプレートファイルには、NIS+ および NIS サービス、ローカルファイル、および LDAP によって使用されるデフォルトのスイッチ構成が含まれています。DNS 用のデフォルトファイルは提供されませんが、これら 4 つのファイルのどれでも編集して DNS 用に使用できます。Solaris ソフトウェアをマシンに最初にインストールするとき、インストール担当者はマシンのデフォルトのネームサービスを選択します。インストール中に、対応するテンプレートファイルが /etc/nsswitch.conf にコピーされます。たとえば、NIS を使用しているクライアントマシンでは、インストールの過程で nsswitch.nis が nsswitch.conf にコピーされます。
ネットワークがインターネットに接続されており、ユーザーが DNS を使用してインターネット上のホストにアクセスする必要がある場合は、DNS 転送を有効にする必要があります。
特殊な名前空間を持っている場合を除き、通常の操作には nsswitch.conf にコピーされるデフォルトのテンプレートファイルを使用します。