NFS

3 篇文章 0 订阅
2 篇文章 0 订阅

NFS

Server

apt install nfs-kernel-server nfs-common -y
vim /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#		to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/mnt/wd *(rw,sync,no_subtree_check)
#1 ro 该主机对该共享目录有只读权限
#2 rw 该主机对该共享目录有读写权限
#3 root_squash 客户机用root用户访问该共享文件夹时,将root用户映射成匿名用户
#4 no_root_squash 客户机用root访问该共享文件夹时,不映射root用户
#5 all_squash 客户机上的任何用户访问该共享目录时都映射成匿名用户
#6 anonuid 将客户机上的用户映射成指定的本地用户ID的用户
#7 anongid 将客户机上的用户映射成属于指定的本地用户组ID
#8 sync 资料同步写入到内存与硬盘中
#9 async 资料会先暂存于内存中,而非直接写入硬盘
#10 insecure 允许从这台机器过来的非授权访问
#11 subtree_check 如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
#12 no_subtree_check 和上面相对,不检查父目录权限
#13 wdelay 如果多个用户要写入NFS目录,则归组写入(默认)
#14 no_wdelay 如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
#15 hide 在NFS共享目录中不共享其子目录
#16 no_hide 共享NFS目录的子目录
#17 secure NFS通过1024以下的安全TCP/IP端口发送
#18 insecure NFS通过1024以上的端口发送
#  均有 读写 同步 不检查父目录权限
#############################################################
# 客户端访问时 不映射root用户 相当于在服务器上用root身份访问该目录 (no_root_squash)
# /srv 192.168.0.1(rw,sync,no_subtree_check,no_root_squash)
#############################################################
# 客户端访问时 映射为用户和用户组都为 1000 的用户
# /srv 192.168.0.1(rw,sync,no_subtree_check,anonuid=1000,anongid=1000)
#############################################################
# 客户端的用户都映射成服务器上的匿名用户(all_squash)
# root_squash,该参数为缺省参数
# /mnt/wd 192.168.0.1(rw,sync,no_subtree_check,all_squash)

/etc/init.d/nfs-kernel-server restart

Client`

mkdir -p /mnt/wd
mkdir -p /mnt/hgst
# chmod -R 777 /wd
mount -t nfs  -o rw 192.168.0.2:/mnt/wd /mnt/wd
mount -t nfs  -o rw 192.168.0.2:/mnt/hgst /mnt/hgst
df -Th

Demo

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值