Ubuntu16.04安装nfs网络文件系统服务器

Ubuntu16.04安装nfs网络文件系统服务器

1. 安装nfs

     $ sudo apt-get install nfs-kernel-server    安装服务器程序

     $ sudo apt-get install nfs-common          安装客户端程序

2. 创建共享目录

    $ mkdir  ~/test

3. 配置nfs

    配置文件为 /etc/exports 文件,打开添加下面一行:

    /home/***/test  *(rw,root_squash,anonuid=1001,anongid=1001,no_subtree_check,sync)

        rw                       挂载该目录的客户端对该目录具有读写权限;

        root_squash        客户端用户是root用户时,将root用户映射为匿名用户anonymous的权限(默认)

        anonuid              指定匿名用户的uid

        anongid              指定匿名用户的gid

        no_subtree_check    不检查父目录的权限

        sync  修改同步写入内存和磁盘

    另外nfs还有其他配置参数,请根据需求添加:

        ro                             read-only 只读权限

        no_root_squash        不将root用户映射为匿名用户

        all_squash                 不论登录用户是什么,都映射为匿名用户

        secure                       数据通过1024以下的安全TCP/IP端口发送

        insecure                    数据通过1024以上的端口发送

        wdelay                      如果有多个用户要写入,则归组写入

        no_wdelay                如果有多个用户要写入,立即写入,当使用async时,无需此设置

        hide                          共享目录不共享其子目录

        no_hide                    共享目录共享器子目录(默认)

        subtree_check           强制检查父目录权限

        async                        修改暂存于内存中,不直接写入磁盘

4. 重启nfs

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

5. 客户端挂载

        sudo mount -t nfs  192.168.1.123:/home/***/test    nfs-client



猜你喜欢

转载自blog.csdn.net/sean_8180/article/details/80001226