Which of the following keywords can be used in the file /etc/nsswitch.conf to specify a source for host name lookups? (Choose TWO correct answers.)
A. resolv
B. dns
C. remote
D. files
E. hosts
题解
部份 GNU C 语言的函数库会根据本地端系统的设置不同而有不同的运作方式,像是 getaliasent、gethostbyname、getnetent 等等的函数。GNU C 语言的函数库会使用 NSS (Name Service Switch)来读取系统的数据库,数据库名称列表如下:
- aliases
- ethers
- group
- hosts
- initgroups
- netgroup
- networks
- passwd
- protocols
- publickey
- rpc
- services
- shadow
NSS 的设置档「/etc/nsswitch.conf」决定了该数据库名称的数据取得的来源和顺序。如「files」表示来源为文件(设置档)、「db」表示来源为数据库、「dns」表示来源为网域名称服务器,而「compat」则有点像是「files」但同时能使用文件来过滤 NIS 来的数据。
答案是选项 B 和选项 D。
