nfs方式訪問海思3516

1.嵌入式linux下掛載nfs出現permission denied的解決方法
在hisi3516下掛載:

ifconfig eth0 192.168.3.99 up            #嵌入式linux ip地址
mount -t nfs -o nolock  192.168.3.251:~/huatu/rootfs /mnt

釋義:
將主機 192.168.3.251:~/huatu/rootfs 文件夾掛載到/mnt文件夾下.

當我們主機上不做操作而直接用上述命令的話,會報linux mount: mounting failed: Permission denied錯誤

解決:
  在 /etc/exports 中加入如下代碼

~/huatu/rootfs *(ro,sync,no_root_squash)

並且重啓nfs服務

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

就能連接上愉快的玩耍了

2.只能讀不能寫的問題
然後就是掛載nfs目錄後只讀不可寫問題了,折騰半天,
後面發現是要求UID,GID與服務器一致
於是在服務器上用id命令一查
$id
uid=1000(oeasy) gid=1000(oeasy) groups=1000(oeasy)

修改/etc/exports
/opt/target *(insecure,rw,sync,all_squash,anonuid=1000,anongid=1000)

服務器上
$sudo service nfs restart

ub上再掛載nfs,發現可寫了。

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