Linux_NIS+NFS+Autofs

举报
云物互联 发表于 2021/08/06 00:11:02 2021/08/06
【摘要】 目录 目录前言NISNFSAutofs搭建NISNFSAutofs Setup NNA environment Setup ServerSiteSetup client 前言 NIS+NFS+Autofs可以实现,网络用户的集中管理。 NIS NIS(网络信息服务):管理用户的帐号信息,是集中控制几个系统管理数据库的网络用品。NIS简...

目录

前言

NIS+NFS+Autofs可以实现,网络用户的集中管理。

NIS

NIS(网络信息服务)管理用户的帐号信息,是集中控制几个系统管理数据库的网络用品。NIS简化了UNIX和LINUX桌面客户的管理工作客户端利用它可以使用中心服务器的管理文件。桌面系统的用户无需建立他们自己的/etc/passwd,他们只简单的使用维护在NIS服务器的文件即可。NIS是一个客户机/服务器系统,ypbind是定义NIS服务器的客户端进程。一旦确定了服务器位置,客户机绑定到了服务器上,所以客户端的住处查询都发往服务器。ypserv是回答客户端查询的服务器进程。

NFS

NFS(Network File System网络文件系统)网络共享用户帐号的home目录。它允许网络中的计算机之间通过TCP/IP网络共享资源。在NFS的应用中,本地NFS的客户端应用可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样。

Autofs

Autofs(自动挂载服务)在用户登录的同时,自动触发挂载用户home目录
mount指令是用来挂载文件系统的,可以在系统启动的时候挂载也可以在系统启动后挂载。对于本地固定设备,如硬盘可以使用mount挂载。而光盘、软盘、NFS、SMB等文件系统具有动态性,即需要的时候才有必要挂载。我们一般不能及时知道NFS共享和SMB什么时候可以挂载,而autofs服务能够及时挂载动态加载的文件系统。免去我们手动载在麻烦。
原理:Autofs与Mount/Umount的不同之处在于,它是一种看守程序。如果它检测到用户正试图访问一个尚未挂接的文件系统,它就会自动检测该文件系统,如果存在,那么Autofs会自动将其挂接。另一方面,如果它检测到某个已挂接的文件系统在一段时间内没有被使用,那么Autofs会自动将其卸载。因此一旦运行了Autofs后,用户就不再需要手动完成文件系统的挂接和卸载。

搭建NIS+NFS+Autofs

集中式用户管理+网络文件系统+自动挂载

Setup NNA environment

Setup ServerSite

step1. Install ypserv

yum install ypserv   #NIS service
  
 
  • 1

step2. Setup the hostname
vim /etc/sysconfig/network

 HOSTNAME=master.nice.com
 NISDOMAIN=nice.com
  
 
  • 1
  • 2

Commands:

hostname master.nice.com
bash
  
 
  • 1
  • 2

step3.
vim /etc/hosts

192.168.0.1 master.nice.com nice.com
192.168.0.2 node.nice.com
  
 
  • 1
  • 2

step4. Start service ypserv

/etc/init.d/ypserv start
  
 
  • 1

step5. Stop iptables,SElinux,NetworkManager service
step6. Create local user and add user to Database.
vim /var/yp/Makefile

/usr/lib64/yp/ypinit -m
  
 
  • 1

step7. Share the directory to client by NFS Service, realize login NIS user at the same time mount the source share directory to goal directory.
For example: Server share /home directory to clientPort by NFS and mount the source share /home directory to client /home/* when login NIS user in the client.

vim /exports (in NFS Server)

/home 192.168.0.0/24(rw) #/home  --> share dir absolute URL #192.168.0.0/24  --> share clientPort IP #(rw)  --> client owned permission
  
 
  • 1
  • 2
  • 3
  • 4

step8. Start the NFS service

service nfs restart
#or 
exportfs -r
  
 
  • 1
  • 2
  • 3

step9. Check the usable share NFS directory in the clientPort

showmount -e ServerIP #can check in serverPort and clientPort.
#or 
exportfs -v #only check in the serverPort
  
 
  • 1
  • 2
  • 3

Setup client

step1.
vim /etc/hosts

192.168.0.1 master.nice.com nice.com
192.168.0.2 node.nice.com
  
 
  • 1
  • 2

step2. Edit the hostname
vim /etc/sysconfig/metwork

HOSTNAME=node.nice.com
  
 
  • 1

Commands:

hostname node.nice.com
bash
  
 
  • 1
  • 2

step3. Setup the autofs
vim /etc/auto.master

/home /etc/auto.home
  
 
  • 1

vim /etc/auto.home

* ServerPortIP:/home/&
  
 
  • 1

step4. Start autofs

service autofs restart
su - userName #Check the autofs server whether successfully.
  
 
  • 1
  • 2

文章来源: is-cloud.blog.csdn.net,作者:范桂飓,版权归原作者所有,如需转载,请联系作者。

原文链接:is-cloud.blog.csdn.net/article/details/50130919

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。