降低linux文件权限,将linux文件 共享给客户机的权限和降低客户机的权限

将/usr/src 共享给192.168.10.20读写访问,同步

192.168.10.21只读访问,异步,访问权限均降为nfsnobody用户

将/root共享通过fstab实现开机自动挂载在

将/usr/src共享通过autofs实现触发挂载

一、查看有没有安装软件包

[root@localhost ~]# rpm -q nfs-utils portmap

nfs-utils-1.0.9-66.el5

portmap-4.0-65.2.2.1

二、修改主配置文件

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

/root 192.168.10.20/24(rw,sync,no_root_squash)

/usr/src 192.168.10.20(rw,sync) 192.168.10.30(ro,async,all_squash)

[root@localhost ~]# setfacl -m u:nfsnobody:rwx /usr/src

三、启动服务

[root@localhost ~]# exportfs -rv

exporting 192.168.10.20:/usr/src

exporting 192.168.10.30:/usr/src

exporting 192.168.10.20/24:/root

四、客户端测试

[root@localhost root]# mkdir -p /data/src

[root@localhost root]# showmount -e 192.168.10.10

Export list for 192.168.10.10:

/root    192.168.10.20/24

/usr/src 192.168.10.30,192.168.10.20

[root@localhost root]# mount -t nfs 192.168.10.10:/usr/src/ /data/src/

五、将/root共享通过fstab实现开机自动挂载

在客户端操作:

[root@localhost root]# cat /etc/fstab

LABEL=/                 /                       ext3    defaults        1 1

LABEL=/boot             /boot                   ext3    defaults        1 2

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

LABEL=SWAP-sda3         swap                    swap    defaults        0 0

192.168.10.10:/root    /nfs/src                 nfs     defaults        0 0

[root@localhost root]# mkdir -p /nfs/src

[root@localhost root]# tail -n 1 /etc/fstab

192.168.10.10:/root    /nfs/src                 nfs     defaults        0 0

[root@localhost root]# mount -a

[root@localhost root]# df -h | grep nfs

192.168.10.10:/root    76G  2.9G   69G   4% /nfs/root

六、将/usr/src共享通过autofs实现触发挂载

[root@localhost ~]# rm -rf /data

[root@localhost ~]# mkdir /data

[root@localhost ~]# cat /etc/auto.master

/data   /etc/auto.data

[root@localhost ~]# cat /etc/auto.data

src     -fstype=nfs,rw  192.168.10.10:/usr/src

[root@localhost ~]# service autofs restart

停止 automount:                                           [确定]

启动 automount:                                           [确定]

[root@localhost ~]# cd /data/src

[root@localhost src]# ls

debug  kernels

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值