1、安装nfs:
sudo apt install nfs-kernel-server
sudo apt install nfs-common
2、修改配置文件:
sudo vim /etc/exports
在最后加上:/home/tao/nfs-share *(rw,sync,no_root_squash)
/home/tao/nfs-share :共享的目录
* :指定哪些用户可以访问
* 所有可以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:mount -t nfs -o nolock 192.168.1.153:/home/tao/nfs-share /mnt/nfs/
192.168.1.153:/home/tao/nfs-share:想要挂在的主机(电脑上的linux)的目录
/mnt/nfs/:板子上的路径
注意:该命令是在板子上运行的!!!!!!