NFS安装与配置

服务器端

yum install -y nfs-utils rpcbind    (安装nfs以及rpcbind[通信协议])

vim /etc/exports    (编辑配置文件,如下)

    /mnt 192.168.111.128(rw,sync)    #分享那个文件夹,到哪个IP地址,以及读写权限和传输协议

    /mnt 192.168.111.128(rw,sync,all_squash,anonuid=501,anongid=501)    #将用户权限限制为501用户,/etc/passwd下必须有这个用户

     /mnt 192.168.111.128(rw,sync,no_root_squash)    #不限制root,不安全!

/etc/init.d/rpcbind start    (开启rpcbind服务)

/etc/init.d/nfs start    (开启nfs服务)

exportfs -arv    (重启nfs服务)

客户端

yum install -y nfs-utils    (安装nfs服务)

showmount -e 192.168.111.129    (查看指定IP有哪些共享的文件夹)

mount -t nfs 192.168.111.129:/mnt /opt    (把客户端的文件夹挂载到本地的opt文件夹下)

mount -t nfs -onolook,nfsvers=3 192.168.111.129:/mnt /opt    (nfs不锁定,且版本指定为3)

df -h    (查看挂载情况)

cd /opt    (移动到opt文件夹下,可对共享文件夹内容进行操作)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章