Chinaunix首页 | 论坛 | 博客
  • 博客访问: 24482
  • 博文数量: 5
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 137
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-03 08:00
文章分类

全部博文(5)

文章存档

2014年(5)

我的朋友

分类: LINUX

2014-03-04 14:17:26

服务器端
1.共享/stu1目录,允许所有的客户端访问该目录,但只具有只读权限。
2.共享/stu2目录,允许10.10.54.0/24网段客户端访问,并且对该目录具有只读权限。
3.共享/stu3目录,10.10.54.0/24网段的客户端具有只读权限,并且将root用户映射成匿名用户。
4.共享/stu4目录,所有人具有读写权限,但当用户使用该共享目录的时候将帐号映射为匿名用户,指定匿名用户的uid/gid为600。
客户端
1.使用showmount命令查看nfs服务器发布的共享目录
2.挂载服务器端的/stu1目录到本地的/mnt/stu1目录
3.卸载/mnt/stu1目录
4.自动挂载nfs服务器上/stu4到本地的/mnt/stu4目录

1,系统配置
     10.10.54.23 服务器
     10.10.54.28 客户端
2,软件安装(服务器端和客户端都安装)
     yum install rpcbind.x86_64 nfs-utils.x86_64
3, 新建目录
   mkdir /stu1 /stu2 /stu3 /stu4
   更改其权限为757
   chmod -R 757 /stu1 /stu2 /stu3 /stu4
4,服务器端修改配置文件/etc/exports
  /stu1 *(ro)
  /stu2 10.10.54.0/24(ro)
  /stu3 10.10.54.0/24(ro,all_squash)
  /stu4 *(rw,all_squash,anonuid=600,anongid=600)
5,创建匿名用户
  [root@wang home]#  groupadd -g 600 nfs
  [root@wang home]# useradd -u 600 -g nfs nfs
  查询nfs用户
  [root@wang home]# groups nfs
  nfs : nfs
6,重启nfs 服务
  [root@wang home]# /etc/init.d/rpcbind restart
  [root@wang home]# /etc/init.d/nfs restart
  [root@wang home]# /etc/init.d/nfslock restart
7,客户端测试(10.10.54.28)
  [root@wang ~]# showmount -e 10.10.54.23
  Export list for 10.10.54.23:
    /stu4 *
    /stu1 *
    /stu3 10.10.54.0/24
    /stu2 10.10.54.0/24
  创建/mnt/stu1
   [root@wang ~]# mkdir /mnt/stu1
   [root@wang ~]# mount -t nfs 10.10.54.23:/stu1 /mnt/stu1
   [root@wang ~]# umount /mnt/stu1
   [root@wang ~]# mkdir /mnt/stu4
   更改开机启动文件
   [root@wang ~]# vi /etc/rc.d/rc.local 
    mount -t nfs 10.10.54.23:/stu4 /mnt/stu4
    [root@wang stu4]# df
    10.10.54.23:/stu4      6192768   2839424   3038720  49% /mnt/stu4
   [root@wang stu4]# mkdir hu
   [root@wang stu4]# ll
    total 4
    drwxr-xr-x 2 600 600 4096 3月   4 11:49 hu
  此外,autofs自动挂载(客户端)
   1,安装软件 
  yum install autofs.x86_64   hesiod.x86_64
   2,修改配置文件
   vi /etc/auto.misc 
    stu4            -rw,bg,soft,rsize=32768,wsize=32768 10.10.54.23:/stu4
   3,重启autofs
      /etc/init.d/autofs restart
   4, 实现开机自动挂载
      [root@wang mnt]# cd /misc/
      [root@wang misc]# ll
       total 0
      [root@wang misc]# cd /misc/stu4
      [root@wang stu4]# mount | grep misc
       none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
       10.10.54.23:/stu4 on /misc/stu4 type nfs         (rw,soft,rsize=32768,wsize=32768,sloppy,vers=4,addr=10.10.54.23,clientaddr=10.10.54.28)
      [root@wang stu4]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2              6192704   1786244   4091888  31% /
tmpfs                   510268         0    510268   0% /dev/shm
/dev/sda1               198337     25842    162255  14% /boot
/dev/sda3              5160576   1384324   3514108  29% /usr
10.10.54.23:/stu4      6192704   2839456   3038656  49% /misc/stu4
































 


阅读(717) | 评论(0) | 转发(0) |
0

上一篇:搭建MHA环境

下一篇:/usr分区磁盘扩容

给主人留下些什么吧!~~