Linux_NIS+NFS+Autofs

简介:

前言

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
  • 1

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

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

Commands:

hostname master.nice.com
bash
  • 1
  • 2
  • 1
  • 2

step3
vim /etc/hosts

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

step4. Start service ypserv

/etc/init.d/ypserv start
  • 1
  • 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
  • 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
  • 1
  • 2
  • 3
  • 4

step8. Start the NFS service

service nfs restart
#or 
exportfs -r
  • 1
  • 2
  • 3
  • 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
  • 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
  • 1
  • 2

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

HOSTNAME=node.nice.com
  • 1
  • 1

Commands:

hostname node.nice.com
bash
  • 1
  • 2
  • 1
  • 2

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

/home    /etc/auto.home
  • 1
  • 1

vim /etc/auto.home

*    ServerPortIP:/home/&
  • 1
  • 1

step4. Start autofs

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


转载:http://blog.csdn.net/jmilk/article/details/50130919

目录
相关文章
|
5月前
|
Linux
Linux安装NFS挂载NFS卸载客户端服务端都有
Linux安装NFS挂载NFS卸载客户端服务端都有
124 0
|
5月前
|
Ubuntu 网络协议 Unix
【Linux】新唐NUC977挂载NFS实现网络文件传输
【Linux】新唐NUC977挂载NFS实现网络文件传输
|
5月前
|
Linux Shell Windows
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
350 0
|
5月前
|
存储 监控 网络协议
【Linux】文件服务NFS(Network File System)
【Linux】文件服务NFS(Network File System)
154 0
|
5月前
|
存储 Linux 网络安全
Linux系统安装NFS服务器
NFS是一种网络文件系统,英文全称Network File System,通过NFS可以让不同的主机系统之间共享文件或目录。通过NFS,用户可以直接在本地NFS客户端读写NFS服务端上的文件,是非常好的共享存储工具。本篇文章将介绍如何在CentOS7上安装NFS服务器,包括服务端和客户端安装两部分。
119 0
|
2月前
|
Ubuntu Linux
内核实验(四):Qemu调试Linux内核,实现NFS挂载
本文介绍了在Qemu虚拟机中配置NFS挂载的过程,包括服务端的NFS服务器安装、配置和启动,客户端的DHCP脚本添加和开机脚本修改,以及在Qemu中挂载NFS、测试连通性和解决挂载失败的方法。
50 0
内核实验(四):Qemu调试Linux内核,实现NFS挂载
|
2月前
|
运维 Ubuntu 安全
在Linux中,如何配置NFS共享?
在Linux中,如何配置NFS共享?
|
2月前
|
网络协议 Ubuntu Linux
在Linux中,如何使用NFS和Samba共享文件和目录?
在Linux中,如何使用NFS和Samba共享文件和目录?
|
2月前
|
网络协议 Unix Linux
Linux 多种方式实现文件共享(三)NFS 6
【8月更文挑战第6天】NFS 即网络文件系统,是一种使用于分布式文件系统的协议,NFS 功能是通过网络让不同的机器,不同的操作系统能够彼此分享各自的数据,让应用程序在客户端通过网络访问位于服务器磁盘中的数据
67 13
|
2月前
|
存储 Linux 网络安全
[linux]搭建nfs
[linux]搭建nfs
下一篇
无影云桌面