NFS服務器

编程入门 行业动态 更新时间:2024-10-25 11:27:34

<a href=https://www.elefans.com/category/jswz/34/1768279.html style=NFS服務器"/>

NFS服務器

服務器端配置

  1. 安裝NFS+rpcbind服務器組件
rpm -qa nfs-utils rpcbind
nfs-utils-1.3.0-0.54.el7.x86_64
rpcbind-0.2.0-38.el7.x86_64
  1. 安裝

    yum install -y nfs-utils rpcbind
    
  2. 配置需要掛載的文件

    mkdir -p /data/share
    chmod 666 /data/share
    

    修改NFS配置文件/etc/exports

    vim /etc/exports

    添加

    /data/share 192.168.77.0/24(rw,sync,insecure,no_subtree_check,no_root_squash)
    參數說明
    ro只读访问
    rw读写访问
    sync所有数据在请求时写入共享
    asyncnfs 在写入数据前可以响应请求
    insecurenfs 通过 1024 以上的端口发送
    wdelay如果多个用户要写入 nfs 目录,则归组写入(默认)
    no_wdelay如果多个用户要写入 nfs 目录,则立即写入,当使用 async 时,无需此设置
    hide在 nfs 共享目录中不共享其子目录
    no_hide共享 nfs 目录的子目录
    subtree_check如果共享 /usr/bin 之类的子目录时,强制 nfs 检查父目录的权限(默认)
    no_subtree_check不检查父目录权限
    all_squash共享文件的 UID 和 GID 映射匿名用户 anonymous,适合公用目录
    no_all_squash保留共享文件的 UID 和 GID(默认)
    root_squashroot 用户的所有请求映射成如 anonymous 用户一样的权限(默认)
    no_root_squashroot 用户具有根目录的完全管理访问权限
    anonuid=xxx指定 nfs 服务器 /etc/passwd 文件中匿名用户的 UID
    anongid=xxx指定 nfs 服务器 /etc/passwd 文件中匿名用户的 GID

    ​ rpcinfo -p localhost

   		 program vers proto   port  service100000    4   tcp    111  portmapper100000    3   tcp    111  portmapper100000    2   tcp    111  portmapper100000    4   udp    111  portmapper100000    3   udp    111  portmapper100000    2   udp    111  portmapper100024    1   udp  33745  status100024    1   tcp  36980  status100005    1   udp  20048  mountd100005    1   tcp  20048  mountd100005    2   udp  20048  mountd100005    2   tcp  20048  mountd100005    3   udp  20048  mountd100005    3   tcp  20048  mountd100003    3   tcp   2049  nfs100003    4   tcp   2049  nfs100227    3   tcp   2049  nfs_acl100003    3   udp   2049  nfs100003    4   udp   2049  nfs100227    3   udp   2049  nfs_acl100021    1   udp  38960  nlockmgr100021    3   udp  38960  nlockmgr100021    4   udp  38960  nlockmgr100021    1   tcp  38362  nlockmgr100021    3   tcp  38362  nlockmgr100021    4   tcp  38362  nlockmgr
  1. 檢查文件掛載

    showmount -e localhost

    Export list for localhost:
    /data/share 192.168.77.0/24
    

客戶端配置

  1. yum install nfs-utils

  2. 查看遠程的可掛載文件

    showmount -e 192.16877.86

    Export list for 192.168.77.86:
    /data/share 192.168.77.0/24
    
  3. 本地創建掛載點

    mkdir /share

    mount 192.168.77.86:/data/share /share

    查看掛載

    df -h

    檢查

    在服務器端添加文件,寫入文字,在客戶端也寫入,刪除

更多推荐

NFS服務器

本文发布于:2023-06-11 23:29:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/645263.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NFS   服務器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!