1. 程式人生 > >A person does not really understand something until after teaching it to a computer. Donald.E.Knuth

A person does not really understand something until after teaching it to a computer. Donald.E.Knuth

1、安裝NFS
sudo apt install nfs-kernel-server

2、建立並設定共享目錄
mkdir  /home/zhenglf/nfs
sudo  gedit  /etc/exports
在最後一行加入
/home/zhenglf/nfs *(rw,sync,no_root_squash)

各段表達的意思如下,根據實際進行修改
/home   :共享的目錄
*       :指定哪些使用者可以訪問
            *  所有可以ping同該主機的使用者
            192.168.1.*  指定網段,在該網段中的使用者可以掛載
            192.168.1.12 只有該使用者能掛載
(ro,sync,no_root_squash):  許可權
        ro : 只讀
        rw : 讀寫
        sync :  同步
        no_root_squash: 不降低root使用者的許可權
    其他選項man 5 exports 檢視

3、重啟NFS
sudo /etc/init.d/nfs-kernel-server restart

4、檢視NFS伺服器(192.168.141.129)上的共享目錄
sudo showmount -e 192.168.141.129
顯示:/home/zhenglf/nfs    *