ubuntu下nfs系統搭建

2021-07-30 23:52:18 字數 1277 閱讀 1972

首先安裝:

apt-get install nfs-kernel-server

配置/etc/exports

vi /etc/exports在最下面加入

/home/topeet/linux/ *(rw,sync,no_root_squash)

其中/home/topeet/linux/是我的共享資料夾

*:代表允許所有的網路段訪問;

rw:是可讀寫許可權;

sync:是資料同步寫入記憶體和硬碟;

no_root_squash:是ubuntunfs客戶端分享目錄使用者的許可權,如果客戶端使用的是

root使用者,那麼對於該共享目錄而言,該客戶端就具有root許可權;

其他ubuntunfs常用的引數有:

ro:唯讀訪問

async:nfs在寫入資料前可以相應請求

secure:nfs通過以下的安全tcp/ip埠傳送

insecure:nfs通過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=***:指定nfs伺服器/etc/passwd檔案中匿名使用者多的uid

anongid=***:指定nfs伺服器/etc/passwd檔案中匿名使用者的gid

接下來重啟portmap服務,輸入/etc/init.d/portmap restart

然後重啟nfs服務,輸入/etc/init.d/nfs-kernel-server restart

測試,本地掛載mount -t nfs localhost:/home/topeet/linux /mnt

掛載到開發板mount -t nfs -o nolock 192.168.2.170:/home/topeet/linux /mnt

ubuntu 下nfs 服務搭建

nfs network file system 網路檔案系統 nfs只是一種檔案系統,本身並沒有傳輸功能,是基於rpc協議實現的,為c s架構。也就是說,nfs也只是檔案系統而已,與jffs2,yaffs,ext4等是一類東西。但是nfs的特殊之處在於,它可以通過網路來掛載,而不用燒寫到裝置上。使用...

ubuntu下的NFS服務搭建

1 執行命令 apt get install nfs kernel server,安裝nfs kernel server 2 執行命令 建立乙個共享的資料夾,此處直接用根目錄檔案 3 配置nfs,執行命令 sudo vim etc exports 4 在文章的最後一行新增 rw,sync,no ro...

Ubuntu 和Centos 系統搭建nfs伺服器

apt get install nfs kernel server hksdata shell 10.45 234 109 rw,sync,no subtree check 說明 hksdata shell 共享的目錄 10.45 234 109 ip位址 rw 可讀可寫 sync 資料同步寫入記憶...