您的位置:首页 > 其它

ubuntu12配置nfs服务

2013-01-28 15:16 190 查看
#sudo apt-get install nfs-kernel-server 安装nfs服务

打开/etc/exports文件,在末尾加入:

/home/kevin *(rw,sync,no_root_squash)

注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:

/home/kevin:要共享的目录

* :允许所有的网段访问

rw :读写权限

sync:资料同步写入内在和硬盘

no_root_squash:nfs客户端共享目录使用者权限

重启服务:

#sudo /etc/init.d/portmap restart <---重启portmap,

#sudo /etc/init.d/nfs-kernel-server restart <---重启nfs服务

#showmount -e <---显示共享出的目录

现在可以在本机上试一下:

#sudo mount -t nfs localhost:/home/kevin /mnt/

注:localhost为本机linux的IP地址

这样就把共享目录挂到了/mnt目录,取消挂载用:

#sudo umount /mnt

如果用在嵌入式设备上挂载,要加上参数-o nolock

我在开发板上使用的挂载命令:

mount -t nfs -o nolock 192.168.1.8:/home/kevin /mnt
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: