Linux nsswithch.conf 详解
发布时间: 更新时间: 总字数:892
阅读时间:2m
作者: 谢先斌
分享
复制网址
专栏文章
- Linux 基础知识
- chroot 技术简介
- Linux 中个目录说明
- 进程、线程、协程的作用和区别
- Linux 动态链接库和静态链接库
- Linux PAM 可插拔认证模块介绍
- Linux limits.conf 详解与配置
- Linux Signal 信号量介绍
- Linux GDB 调试
- Linux core dump 文件介绍
- Linux procfs 介绍
- Linux 进程 /proc/PID/status 深入分析
- Linux sysfs 介绍
- Linux nsswithch.conf 详解(当前)
- Linux Systemd 介绍
- Linux Interrupt 中断介绍
- Linux namespace 介绍
- Linux Cgroups 介绍
- Linux Capabilities 介绍
名字服务切换配置
NSS(name service switch configuration)
的配置文件为/etc/nsswitch.conf
,它被GNU C库
和其他应用程序使用,以确定要从哪些来源、按什么顺序获取指定类别信息的服务。
来源
/etc/nsswitch.conf
由 glibc
包提供,glibc
是 GNU
发布的 libc
库,即 C
运行库。 glibc
是 linux
系统中最底层的 api
,几乎其它任何运行库都会依赖于 glibc
。
配置格式
databases: method[[action]] [method[[action]]...]
说明:
- 按照从左到右的搜索顺序,如果第一个没有找到,会自动到第二个method查询
databases
- aliases: 邮件别名,
getaliasent(3)
和相关函数使用 - ethers: Ethernet numbers.
- group: getgrent(3)和相关函数使用的用户组
- hosts: 主机名和主机号(
/etc/hosts
),gethostbyname()以及类似的和相关函数使用 - initgroups: 补充组访问列表,`getgrouplist(3)和相关函数使用
- netgroup: 网络范围的主机和用户列表,用于访问规则
- networks: 网络名及网络号(
/etc/networks
),getnetent(3)
和相关函数使用 - passwd: 用户口令(
/etc/passwd
),getpwent(3)
和相关函数使用 - protocols: 网络协议(
/etc/protocols
),getprotoent(3)
和相关函数使用 - publickey: NIS+及NFS所使用的
Secure_RPC
的公开密钥 - rpc: 远程过程调用名及调用号(
/etc/rpc
),getrpcbyname(3)
及类似和相关函数使用 - services: 网络服务(
/etc/services
),getservent(3)
和相关函数使用 - shadow: 映射用户密码(
/etc/shadow
),getspnam(3)
和相关函数使用
method
- files: 搜索本地文件,如
/etc/passwd
和/etc/hosts
,由/lib64/libnss_files.so.2
实现 - nis: 搜索NIS数据库,参考:NIS 使用介绍,由
/lib64/libnss_nis.so.2、/lib64/libnss_nisplus.so.2
实现 - dns: 查询本机 DNS(
/etc/resolv.conf
),由/lib64/libnss_dns.so.2
实现 - compat: passwd、group 和 shadow 文件中的±语法,由
/lib64/libnss_compat.so.2
实现 - mdns4_minimal:
/lib64/libnss_mdns4.so.2
- hesiod:
/lib64/libnss_hesiod.so.2
- db: Use the local database (.db) files
- sss: Use sssd (System Security Services Daemon)
action 可选
- [STATUS=ACTION]
- [!STATUS=ACTION]
说明:
- STATUS => success | notfound | unavail | tryagain
- ACTION => return | continue | merge
示例
$ cat /etc/nsswitch.conf
# /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 ldap # 表示先搜索本地问题,若没有找到,搜索 ldap
group: compat ldap
shadow: compat ldap
gshadow: files
- 上一页:Docker 端口映射原理
- 下一页:Linux sysfs 介绍
专栏文章
- Linux 基础知识
- chroot 技术简介
- Linux 中个目录说明
- 进程、线程、协程的作用和区别
- Linux 动态链接库和静态链接库
- Linux PAM 可插拔认证模块介绍
- Linux limits.conf 详解与配置
- Linux Signal 信号量介绍
- Linux GDB 调试
- Linux core dump 文件介绍
- Linux procfs 介绍
- Linux 进程 /proc/PID/status 深入分析
- Linux sysfs 介绍
- Linux nsswithch.conf 详解(当前)
- Linux Systemd 介绍
- Linux Interrupt 中断介绍
- Linux namespace 介绍
- Linux Cgroups 介绍
- Linux Capabilities 介绍
最近更新
最新评论
加载中...