nfs-utils-1.2.2-7.el6.x86_64 rpcbind-0.2.0-8.el6.x86_64
[root@deyu ~]# vim /etc/exports # 分享目錄 分享給主機(參數) /home/guests 192.168.122.0/255.255.255.0(rw,sync) # 參數 * rw:read-write,可讀寫的權限; * ro:read-only,唯讀的權限; * sync:資料同步寫入到記憶體與硬碟當中; * async:資料會先暫存於記憶體當中,而非直接寫入硬碟。 * no_root_squash: 登入 NFS 主機使用分享目錄的使用者如果是 root,對於分享的目錄具有 root 的權限。 極不安全,不建議使用。 * root_squash: 登入 NFS 主機使用分享目錄的使用者如果是 root,權限將被壓縮成匿名使用者, 通常他的 UID 與 GID 都會變成 nobody(nfsnobody) 那個系統帳號的身份; * all_squash: 不論登入 NFS 的使用者身份為何,都會被壓縮成為匿名使用者,通常是 nobody(nfsnobody) 。 * anonuid: anon 意指 anonymous (匿名者),自訂匿名使用者的 UID。 * anongid:自訂匿名使用者的是變成 GID。
[root@deyu ~]# /etc/init.d/rpcbind start Starting rpcbind: [ OK ]
[root@deyu ~]# /etc/init.d/nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ]
[root@deyu ~]# chkconfig rpcbind on [root@deyu ~]# chkconfig --list rpcbind rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@deyu ~]# chkconfig nfs on [root@deyu ~]# chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@deyu ~]# showmount [-ae] [hostname|IP] 參數: -a :顯示目前主機與用戶端的 NFS 連線分享的狀態; -e :顯示某部主機的 /etc/exports 所分享的目錄資料。 [root@deyu ~]# showmount -e deyu.wang Export list for deyu.wang: /home/guests 192.168.122.0/255.255.255.0
[root@deyu ~]# exportfs [-aruv] 參數: -a :全部掛載(或卸載) /etc/exports 檔案內的設定 -r :重新掛載 /etc/exports 的設定,亦同步更新 /etc/exports 及 /var/lib/nfs/xtab 的內容。 -u :卸載某一目錄 -v :在 export 時將分享的目錄顯示到螢幕上。 [root@deyu ~]# vim /etc/exports /home/guests 192.168.111.0/255.255.255.0(rw,sync) [root@deyu ~]# exportfs -arv exporting 192.168.111.0/255.255.255.0:/home/guests
2015-04-13