您的位置:首页 > 其它

ubuntu 9.10 NFS挂载设置

2010-06-20 22:38 363 查看

ubuntu 9.10 NFS挂载设置

2010-05-12 文章来源:互联网 浏览次数:153

Ubuntu没有NFS和portmap 需要安装

服务器:

sudo apt-get install nfs-kernel-server portmap

修改 /etc/exports 增加以下内容

/work/nfs *(rw,sync,no_root_squash)

/work/nfs
为你要共享的文件夹
,*表示可以任何IP访问,当然也可以写上IP地址。rw表示读写访问,如果是只读的话,可改为ro。sync:数据同步写入内存和硬盘,也可以使用
async,此时数据会先暂存于内存中,而不立即写入硬盘。 no_root_squash:NFS 服务器共享目录用户的属性,如果用户是
root,那么对于这个共享目录来说就具有 root 的权限。

也可以启用保护机制,

可以通过设定/etc/hosts.deny和/etc/hosts.allow文件来限制网络服务的存取权限。

***/etc/hosts.deny***

portmap:ALL

lockd:ALL

mountd:ALL

rquotad:ALL

statd:ALL

***/etc/hosts.allow***

portmap:192.168.1.101

lockd:192.168.1.101

mountd:192.168.1.101

rquotad:192.168.1.101

statd:192.168.1.101

第一个文件表示阻止的IP 第二个文件表示开放的IP

同时使用这两个文件就会使得只有ip为192.168.1.101的机器使用NFS服务

不过以上我都没有设置

接着重启portmap和nfs

sudo /etc/init.d/portmap start

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

然后可以测试是否能nfs 我的主机IP是 192.168.1.100 客户端的IP是192.168.1.230(服务器和客户端要同一IP段)

在服务器主机里输入

sudo mount -t nfs 192.168.1.100:/work/nfs /mnt/nfs

然后就可以在 /mnt/nfs下看到 /work/nfs 的东西了

客户端:

sudo apt-get install nfs-common

mount -t nfs -o nolock 192.168.1.100:/work/nfs /mnt/nfs

然后客户端上也可以找到主机上的东西了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: