zoukankan      html  css  js  c++  java
  • Linux12.2 NFS配置

      服务端

    yum install -y nfs-utils rpcbind
    
     vim /etc/exports //加入如下内容
    /home/nfstestdir 
     192.168.212.130(rw,sync,all_squash,anonuid=1000,anongid=1000)
    #IP和配置不能有空格
    
     mkdir /home/nfstestdir
     chmod 777 /home/nfstestdir
     systemctl start rpcbind 
     systemctl start nfs
     systemctl enable rpcbind 
     systemctl enable nfs
    

      服务端配置说明

    rw 读写
    ro 只读
    sync 同步模式,内存数据实时写入磁盘
    async 非同步模式
    no_root_squash 客户端挂载NFS共享目录后,root用户不受约束,权限很大
    root_squash 与上面选项相对,客户端上的root用户收到约束,被限定成某个普通用户
    all_squash 客户端上所有用户在使用NFS共享目录时都被限定为一个普通用户
    anonuid/anongid 和上面几个选项搭配使用,定义被限定用户的uid和gid

      客户端

    yum install -y nfs-utils
    showmount -e 192.168.212.131 //该ip为NFS服务端ip
    mount -t nfs 192.168.212.131:/home/nfstestdir /mnt
    df -h
    touch /mnt/aminglinux.txt
    ls -l /mnt/aminglinux.txt //可以看到文件的属主和属组都为1000
    

      记得关闭防火墙,iptables和selinux

      在CentOS6中遇到比较多,客户端文件属主属组nobody,客户端挂载共享目录后,不管是root用户还是普通用户,创建新文件时属主、属组为nobody。

      两种方法:一般第一种方法方便可以解决

    • 客户端挂载时加上 -o nfsvers=3
    mount -t nfs  -oremount,nfsvers=3  ........
    • 客户端和服务端都需要
    vim /etc/idmapd.conf //
     把“#Domain = local.domain.edu” 改为 “Domain = xxx.com” (这里的xxx.com,随意定义吧),然后再重启rpcbind服务
    

      

  • 相关阅读:
    ORACLE触发器简单列子
    接口测试中需要携带token的接口返回结果偶尔报无权限
    接口自动化测试用例偶尔报无权限的解决办法
    python中的faker库生成数据,并写入txt文本中
    anaconda在sys.path删除~/.local/lib
    题解12/12 模拟赛
    题解BalticOI 2020
    题解12/09 模拟赛
    亿些原古博客汇总
    bijective proof problems 选做
  • 原文地址:https://www.cnblogs.com/chyuanliu/p/9366657.html
Copyright © 2011-2022 走看看