ubuntu下搭建samba和nfs服务器

1、samba 
apt-get install samba
修改/etc/samba/smb.conf 
结尾添加共享目录
[Share]
path = /mnt/test
public = yes
writable = yes
   
[myshare]
path = /mnt/work
public = yes
writable = yes

2、nfs
①server
apt-get install nfs-kernel-server              
修改/etc/exports 添加共享目录
/nfs *(rw,insecure,no_root_squash,sync,no_subtree_check)

表示所有主机都可挂载 /nfs 目录并拥有读写(rw)权限,而且任何 root 权限(UID=0 , GID=0)的文件操作都不默认映射给 nobody:nogroup,而保持属主(组)仍为 root(no_root_squash)
insecure 选项:允许通过任意端口的远程访问
sync 选项:强制 NFS 服务器在响应请求之前将文件的改动写入磁盘(强调客户端和服务端文件内容的一致性,但会降低文件操作的效率)。
no_subtree_check 选项:禁用 subtree_check , subtree_check 用来设置服务器在收到请求时,检查该文件是否在指定目录结构中依旧可用(该选项会在某些情况下发生错误:重命名某文件的同时,该文件在客户端打开)。

② client:
apt-get install nfs-common                   
mount -t nfs ip:/nfs /mnt/nfs/

猜你喜欢

转载自blog.csdn.net/qq_34870631/article/details/86301224