NFS服务器配置

简介【C/S模式】 

NFS 是Network File System的简写,即网络文件系统,网络文件系统是FreeBSD支持的文件系统中的一种,也被称为NFS.NFS允许一个系统在网络上与他人共享目录和文件,通过使用NFS,用户和程序可以像访问本地文件一样访问远程系统上的文件

(感觉没有samba服务好,不能Linux和Windows共享)

安装包:

 #rpm -ivh /mnt/Packages/nfs-utils-1.2.3.**.rpm 或#yum install nfs-utils

对应端口号可以,vim /etc/service 搜索nfs     -----  2049

 客户端命令:mount 和showmount 

 #showmount -e NFS IP 例如#showmount -e 192.168.1.63

挂载:#mount -t 192.168.1.63/tmp/a /mnt

 开机挂载:#vim /etc/fstab

192.168.1.63:/media  /opt  nfs  default  0  0

 配置文件:

#vim /etc/exports

 对共享做一些特殊处理(主要看写法)

/tmp/a/no_root_squash  *(rw,no_root_squash) #所有ip可以访问挂载 可读可写

/tmp/a/sync  192.168.1.0/24(rw,sync) #指定ip段可以访问挂载 可读可写

/tmp/a/ro  192.168.1.64(ro) #只读

/tmp/a/all_squash  *.baidu.com(rw,all_squash,anonuid=500,anongid=500) #指定500用户的权限?

/tmp/a/async  192.168.3.0/255.255.255.0(async)

/tmp/a/rw  192.168.3.0/255.255.255.0(rw)  192.168.4.0/24(rw)

/tmp/a/root_squash  *(rw,root_squash)

运行

#service nfs start

 查看:#netstat -antup |grep 2049

NFS服务器运行原理

实战配置NFS服务器

autofs自动挂载

原文地址:https://www.cnblogs.com/fps2tao/p/8586290.html