前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 6.5系统下实现NFS共享

CentOS 6.5系统下实现NFS共享

作者头像
星哥玩云
发布2022-07-01 15:04:09
4270
发布2022-07-01 15:04:09
举报
文章被收录于专栏:开源部署

网络环境

一台Linux server ip 192.168.1.254,一台Linux client ip 192.168.1.100

操作系统:CentOS 6.5

需求描述

1:将/root 共享给192.168.1.100,可写、同步,允许客户机以root权限访问

2:将/usr/src 共享给192.168.1.0/24网段,可写、异步

3:在上一个实验基础上实现客户端上面所有用户身份都映射成nfsnobody

实施步骤

1:查看nfs程序是否安装

[root@server ~]# rpm -qa |grep nfs 查看nfs是否安装

nfs-utils-1.2.3-39.el6.i686

[root@server ~]# rpm -qa |grep rpcbind 查看RPC是否安装

rpcbind-0.2.0-11.el6.i686

2:启动服务并设为开机启动

[root@server ~]# service nfs start

[root@server ~]# service rpcbind start

[root@server ~]# chkconfig rpcbind on

[root@server ~]# chkconfig nfs on

3:备份nfs配置文件

[root@server ~]# cp /etc/exports /etc/exports.bak

4:编辑配置文件实现需求1,2要求

[root@server ~]# vim /etc/exports

/root 192.168.1.100(rw,sync,no_root_squash)

/usr/src 192.168.1.0/24(rw,async)

5:重启服务

[root@server ~]# service nfs restart

[root@server ~]# service rpcbind restart

6:服务器端设置/usr/src本地写权限

[root@server ~]# chmod o+w /usr/src/

7:客户机测试

[root@client ~]# mkdir -p /data/root

[root@client ~]# mount 192.168.1.254:/root /data/root/

[root@client ~]# mkdir -p /tmp/src

[root@client ~]# mount 192.168.1.254:/usr/src /tmp/src/

[root@client ~]# mount |tail -2

192.168.1.254:/root on /data/root type nfs (rw,vers=4,addr=192.168.1.254,clientaddr=192.168.1.100)

192.168.1.254:/usr/src on /tmp/src type nfs (rw,vers=4,addr=192.168.1.254,clientaddr=192.168.1.100)

[root@client ~]# cd /data/root/ 进入挂载目录测试需求1

[root@client root]# touch nfs

[root@client root]# ll

-rw-r--r--. 1 root root        0 6月  14 14:14 nfs

[sw@client src]$ cd /tmp/src 普通用户进入挂载目录测试需求2

[sw@client src]$ touch nks

[sw@client src]$ ll

-rw-r--r--. 1 sw sw    0 6月  14 14:25 nks

8:需求3把所有用户都映射成nfsnobody

[root@server ~]# cat /etc/exports

/root 192.168.1.100(rw,sync,all_squash)

/usr/src 192.168.1.0/24(rw,async,all_squash)

[root@server ~]# chmod o-w /usr/src 清除上面实验的权限

[root@server ~]# setfacl -m u:nfsnobody:rwx /usr/src/ 设置访问控制列表

9:客户机测试

[sw@client src]$ touch nksss

[sw@client src]$ ll

-rw-r--r--. 1 nfsnobody nfsnobody    0 6月  14 14:28 nksss

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档