服务器上配置:
[root@gjp99 public]# mkdir /gjp
[root@gjp99 public]# cat /etc/exports
/public 192.168.10.0/24(ro)
/gjp 192.168.10.0/24(rw,sync) //增加此行
注意:子网掩码后面不能有空格!
[root@gjp99 public]# ll -d /gjp
drwxr-xr-x 2 root root 4096 Aug 3 18:12 /gjp
[root@gjp99 public]# chmod o+wt /gjp
[root@gjp99 ~]# ll -d /gjp
drwxr-xrwt 2 root root 4096 Oct 15 10:32 /gjp
[root@gjp99 ~]# exportfs -rv
exporting 192.168.10.0/24:/public
exporting 192.168.10.0/24:/gjp
客户端上:
[root@mail ~]# mkdir /mnt/gjp
[root@mail ~]# mount 192.168.10.99:/gjp /mnt/gjp
[root@mail ~]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.10.99:/gjp on /mnt/gjp type nfs (rw,addr=192.168.10.99)
[root@mail ~]# cd /mnt/gjp
[root@mail gjp]# ll
total 0
[root@mail gjp]# touch gjp
[root@mail gjp]# ll
total 0
-rw-r--r-- 1 nfsnobody nfsnobody 0 Oct 15 2012 gjp
服务器上:
man exports
[root@gjp99 ~]# vim /etc/exports
/public 192.168.10.0/24(ro)
/gjp 192.168.10.0/24(rw,no_root_squash,sync)增加参数:取消映射关系
[root@gjp99 ~]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@gjp99 ~]# service autofs restart
Stopping automount: [ OK ]
Starting automount: [ OK ]