欢迎光临散文网 会员登陆 & 注册

Debian中配置NIS:用户账号管理

2022-08-28 16:37 作者:限量版范儿  | 我要投稿

一、服务端(Server端192.168.109.137)

1、安装软件包

apt-get update apt install -y nis

安装过程中设置域名


vim /etc/defaultdomain查看设置域名
 


2、设置nis主服务器

vim /etc/default/nis

将NISSERVER=false改为NISSERVER=master

3、设置可以允许访问我们的 NIS 服务器的IP范围

vim /etc/ypserv.securenets

先注释掉下图中显示的行:


将允许的 IP 范围添加到该文件的末尾,如下图所示。之后,我们可以保存并关闭我们的文件。


4、为NIS添加自己的IP地址

vim /etc/hosts


5、重新启动 NIS 服务器

systemctl restart rpcbind ypserv yppasswdd ypxfrd systemctl enable rpcbind ypserv yppasswdd ypxfrd systemctl restart nis

6、创建一个测试用户、并更新NIS数据库

adduser nistest /usr/lib/yp/ypinit -m

按Ctrl + D,再按y确认

//每次更新账户信息后都需要更新数据库 //cd /var/yp //make //make -C /var/yp/

现在执行下面的命令,并可以看到用户口令表

getent passwd

二、Client(客户端192.168.109.142)

1、安装软件包

apt-get update apt install -y nis

查看vim /etc/defaultdomain里的域名


2、修改配置文件vim /etc/default/nis 确保有如下设置,配置为 NIS 客户端


3、修改vim /etc/yp.conf加入下面的设置


4、在passwd、shadow、group以及hosts行的files后面都添加上nis。

vim /etc/nsswitch.conf


5、启动服务并设置开机启动

systemctl restart rpcbind nscd ypbind systemctl restart rpcbind ypbind systemctl enable rpcbind ypbind

6、yptest测试

ypcat passwd

登录


大功告成。

其它

检查 Debian 10 上“rpcbind”服务的状态:

systemctl status rpcbind 

检查 Debian 10 上“ypserv”服务的状态

systemctl status ypserv

链接:https://www.dianjilingqu.com/505037.html

Debian中配置NIS:用户账号管理的评论 (共 条)

分享到微博请遵守国家法律