Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

第 5 章 File Share

目录

5.1. NFSv4
5.1.1. Installation
5.1.1.1. NFSv4 server
5.1.1.2. NFSv4 client
5.1.2. exports
5.1.2.1. Permission
5.1.2.2. Parameters
5.1.2.3. 实例参考
5.2. Parallel NFS(pNFS)
5.3. Samba
5.3.1. install
5.3.1.1. Ubuntu
5.3.1.2. CentOS
5.3.1.3. firewall
5.3.1.4. SELinux Configuration
5.3.2. smb.conf
5.3.2.1. Security consideration
5.3.3. testparm - check an smb.conf configuration file for internal correctness
5.3.4. smbstatus - report on current Samba connections
5.3.5. smbpasswd - change a user's SMB password
5.3.6. nmblookup - NetBIOS over TCP/IP client used to lookup NetBIOS names
5.3.7. smbfs/smbmount/smbumount
5.3.8. smbclient - ftp-like client to access SMB/CIFS resources on servers
5.3.8.1. 显示共享目录
5.3.8.2. 访问共享资源
5.3.8.3. 用户登录
5.3.9. smbtar - shell script for backing up SMB/CIFS shares directly to UNIX tape drives
5.3.10. by Example
5.3.10.1. share
5.3.10.2. user
5.3.10.3. test
5.3.11. FAQ
5.3.11.1. smbd/service.c:make_connection_snum(1013)

5.1. NFSv4

5.1.1. Installation

5.1.1.1. NFSv4 server

sudo apt-get install nfs-kernel-server
			

Configuration

vim /etc/exports
/www	 *(ro,sync,no_root_squash)
/home    *(rw,sync,no_root_squash)
/export       192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/export/users 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)
			

To start the NFS server

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

5.1.1.2. NFSv4 client

sudo apt-get install nfs-common
			

NFSv3

sudo mount example.hostname.com:/www /www
			

NFSv4

# mount -t nfs4 -o proto=tcp,port=2049 nfs-server:/ /mnt
# mount -t nfs4 -o proto=tcp,port=2049 nfs-server:/users /home/users
			

NFS Client Configuration

vim /etc/fstab
example.hostname.com:/ubuntu /local/ubuntu nfs rsize=8192,wsize=8192,timeo=14,intr
			

5.1.2. exports

5.1.2.1. Permission

/etc/exports为:

/tmp     *(rw,no_root_squash)

/home/public 192.168.0.*(rw)   *(ro)

/home/test  192.168.0.100(rw)

/home/linux  *.example.com(rw,all_squash,anonuid=40,anongid=40)
			

5.1.2.2. Parameters

General Options

ro                      只读访问
rw                      读写访问
rsize					同时传输(读 )的数据块大小
wsize					同时传输(写)的数据块大小

sync                    所有数据在请求时写入共享
async                   NFS在写入数据前可以相应请求

secure                  NFS通过1024以下的安全TCP/IP端口发送
insecure                NFS通过1024以上的端口发送
wdelay                  如果多个用户要写入NFS目录,则归组写入(默认)
no_wdelay               如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
hide                    在NFS共享目录中不共享其子目录
no_hide                 共享NFS目录的子目录
subtree_check           如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
no_subtree_check        和上面相对,不检查父目录权限
			

User ID Mapping

all_squash              共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
no_all_squash           保留共享文件的UID和GID(默认)
root_squash             root用户的所有请求映射成如anonymous用户一样的权限(默认)
no_root_squas           root用户具有根目录的完全管理访问权限
anonuid=xxx             指定NFS服务器/etc/passwd文件中匿名用户的UID
anongid=xxx             指定NFS服务器/etc/passwd文件中匿名用户的GID
			

5.1.2.3. 实例参考

只读挂载

172.16.2.5:/   /www/images   nfs4       ro,rsize=8192,wsize=8192,timeo=15,intr,noac
			
comments powered by Disqus