加载中…
个人资料
阳光下
阳光下
  • 博客等级:
  • 博客积分:0
  • 博客访问:0
  • 关注人气:0
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

NFS V3客户端,用户超过16个组,无法访问NFS的mount

(2012-01-08 16:13:41)

/etc/group文件含如下内容:

test1:x:502:cjeff
test2:x:503:cjeff
test3:x:504:cjeff
test4:x:505:cjeff
test5:x:506:cjeff
test6:x:507:cjeff
test7:x:508:cjeff
test8:x:509:cjeff
test9:x:510:cjeff
test10:x:511:cjeff
test11:x:512:cjeff
test12:x:513:cjeff
test13:x:514:cjeff
test14:x:515:cjeff
test15:x:516:cjeff
test16:x:517:cjeff
test16:x:517:cjeff
test17:x:518:cjeff
test18:x:519:cjeff
test19:x:520:cjeff
test20:x:521:cjeff
test21:x:522:cjeff,jeff

 

/etc/passwd文件含如下内容

cjeff:x:501:502::/home/cjeff:/bin/bash
jeff:x:502:522::/home/jeff:/bin/bash

mount如下:

10.128.13.23:/vol/cjeff on /home/test type nfs (rw,addr=10.128.13.23)

/home/test目录属性如下:

# ls -l /home
drwxrwx--- 4 jeff test21  4096 Jan  5 14:28 test

用户cjeff进入/home/test,报Permission denied

-bash-3.2$ whoami
cjeff
-bash-3.2$ cd /home/test
-bash: cd: /home/test: Permission denied

在下面这篇文章中,提到了具体的原因和解决方法:

http://nfsworld.blogspot.com/2005/03/whats-deal-on-16-group-id-limitation.html

 

主要的原因是AUTH_SYS:

AUTH_SYS sends 3 important things:

  • A 32 bit numeric user identifier (what you'd see in the UNIX /etc/passwd file)
  • A 32 bit primary numeric group identifier (ditto)
  • A variable length list of up to 16 32-bit numeric supplemental group identifiers (what'd you see in the /etc/group file)

解决方法之一是采用NFS v4客户端,并且要不使用AUTH_SYS,而是使用RPCSEC_GSS,或者Kerberos。另外一个解决方法是使用http://www.frankvm.com/nfs-ngroups/中的patch重新编译内核。

 

使用的是RHEL 5.5,内核为2.6.18。从下面的地址下载内核:

ftp://ftp.redhat.com/redhat/linux/enterprise/5Server/en/os/SRPMS/

如kernel-2.6.18-194.el5.src.rpm。

 

运行rpm -ihv kernel-2.6.18-194.el5.src.rpm将内核源码安装到/usr/src/redhat/SOURCES。

在/usr/src/redhat/SOURCES目录下,运行

bzip2 -d linux-2.6.18.tar.bz2

tar xvf linux-2.6.18.tar

 

http://www.frankvm.com/nfs-ngroups/下载2.6.18-nfs-ngroups-4.54.patch,存放于/tmp目录下。

 

进入/usr/src/redhat/SOURCES/linux-2.6.18目录,运行

patch -p1 --fuzz=2 -s < /tmp/2.6.18-nfs-ngroups-4.54.patch

编辑makefile,将第四行修改为:
EXTRAVERSION = -nfs

make menuconfig;make clean;make bzImage; make modules;make modules_install

 

mkinitrd /boot/initrd-2.6.18-nfs.img 2.6.18-nfs

此时报错WARNING: No module ata_piix found

 

根据http://blog.csdn.net/rainharder/article/details/2667197,在make menuconfig时,需要选择

Device Drivers -->  SCSI device support --> SCSCI low-level drivers --> [M] Serial ATA (SATA) support --> [M] Intel PIIX/ICH SATA support

 

重复上面的make过程。

 

复制新编译的内核和System.map文件到/boot目录。

cp arch/i386/boot/bzImage /boot/bzImage-2.6.18-nfs
cp System.map /boot/System.map-2.6.18-nfs

在/boot目录,运行

ln -s System.map-2.6.18-nfs ./System.map


修改/etc/grub.conf为:

default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-194.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-194.el5.img
title Red Hat Enterprise Linux Server (2.6.18-nfs)
        root (hd0,0)
        kernel /bzImage-2.6.18-nfs ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-nfs.img

重启RHEL Server。

# uname -a
Linux wikid 2.6.18-nfs #3 SMP Fri Jan 6 18:46:25 CST 2012 i686 i686 i386 GNU/Linux

# mount 10.128.13.23:/vol/cjeff /home/test

 

-bash-3.2$ whoami
cjeff
-bash-3.2$ ls -l /home
drwxrwx--- 4 jeff test21  4096 Jan  5 14:28 test
-bash-3.2$ cd /home/test
-bash-3.2$ ls -l
drwxrwx--- 2 jeff test21 4096 Jan  5 14:28 1
-bash-3.2$ pwd
/home/test

 

关于内核rebuild,参见http://en.linuxreviews.org/Kernel_Rebuild_Guide


 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有