Linux_NIS+NFS+Autofs

网友投稿 461 2022-05-28

目录

目录

前言

NIS

NFS

Autofs

搭建NISNFSAutofs

Setup NNA environment

Setup ServerSite

Setup client

前言

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

Linux_NIS+NFS+Autofs

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

Linux 网络

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:【技术补给站】第10期:分析内部运行机制,教你解决Redis性能问题
下一篇:个推CTO谈数据中台(上):从要求、方法论到应用实践
相关文章