N8000新建homedir共享无法访问

发布时间:  2013-09-29 浏览次数:  220 下载次数:  0
问题描述
1. 创建文件系统data1和data2;
zhu2.Storage> fs create simple data1 100g pool1
100% [#] Creating simple filesystem  

zhu2.Storage> fs create simple data2 100g pool1
100% [#] Creating simple filesystem  

2. 设置文件系统data1为homedir共享;
N8300D1.CIFS> set homedirfs data1                                                                                                                                             Global option updated. Note: Restart the CIFS server.

3. 重启CIFS服务;
N8300D1.CIFS> server start
Starting CIFS Server.....Success.
N8300D1.CIFS> show
                    Name  Value
                    ----  -----
            netbios name  N8300D1
               ntlm auth  yes
   allow trusted domains  no
               homedirfs  data1
                   quota  10m
           idmap backend  rid:10000-20000
               workgroup  TD
                security  user
                  Domain  TD.COM
             Domain user  administrator
       Domain Controller  129.22.112.250

4. 创建用户zhu1;
N8300D1.CIFS> local user add zhu1                                                                                                                                            Adding USER : zhu1
Success: User zhu1 created successfully

5. 用户zhu1可以通过windows客户端正常访问该homedir共享;


6. 设置文件系统data2为homedir共享;
N8300D1.CIFS> set homedirfs data2                                                                                                                                             Global option updated. Note: Restart the CIFS server.

7. 重启CIFS服务;
N8300D1.CIFS> server start
Starting CIFS Server.....Success.
N8300D1.CIFS> show
                    Name  Value
                    ----  -----
            netbios name  N8300D1
               ntlm auth  yes
   allow trusted domains  no
               homedirfs  data2
                   quota  10m
           idmap backend  rid:10000-20000
               workgroup  TD
                security  user
                  Domain  TD.COM
             Domain user  administrator
       Domain Controller  129.22.112.250

8.用户zhu1不可以通过windows客户端正常访问该homedir共享;
告警信息
访问共享告警信息:
处理过程
删除/var/lib/nfs/sm/links下面的用户link信息后,用户zhu1可以正常访问homedirfs共享。
N8300D1_01:/var/lib/nfs/sm # rm -r links

根因
1. 查看/var/log/message日志,可以看到目录/vx/data2/LOCAL/zhu1未创建成功;
N8300D1_01:/opt/VRTSnasgw/log # tail -f /var/log/messages
2010 Mar 19 19:06:40 N8300D1_01 smbd[15579]: [2010/03/19 19:06:40,  0] smbd/service.c:make_connection_snum(1156)
2010 Mar 19 19:06:40 N8300D1_01 smbd[15579]:   \'/vx/data2/LOCAL/zhu1\' does not exist or permission denied when connecting to [_home1$] Error was No such file or directory
2010 Mar 19 19:06:41 N8300D1_01 smbd[20990]: [2010/03/19 19:06:41,  0] smbd/service.c:make_connection_snum(1156)
2010 Mar 19 19:06:41 N8300D1_01 smbd[20990]:   \'/vx/data2/LOCAL/zhu1\' does not exist or permission denied when connecting to [_home1$] Error was No such file or directory
2010 Mar 19 19:06:42 N8300D1_01 smbd[20990]: [2010/03/19 19:06:42,  0] smbd/service.c:make_connection_snum(1156)
2010 Mar 19 19:06:42 N8300D1_01 smbd[20990]:   \'/vx/data2/LOCAL/zhu1\' does not exist or permission denied when connecting to [_home1$] Error was No such file or directory
2010 Mar 19 19:06:43 N8300D1_01 smbd[15579]: [2010/03/19 19:06:43,  0] smbd/service.c:make_connection_snum(1156)
2010 Mar 19 19:06:43 N8300D1_01 smbd[15579]:   \'/vx/data2/LOCAL/zhu1\' does not exist or permission denied when connecting to [_home1$] Error was No such file or directory
2010 Mar 19 19:06:44 N8300D1_01 smbd[21642]: [2010/03/19 19:06:44,  0] smbd/service.c:make_connection_snum(1156)
2010 Mar 19 19:06:44 N8300D1_01 smbd[21642]:   \'/vx/data2/LOCAL/zhu1\' does not exist or permission denied when connecting to [_home1$] Error was No such file or directory

2. 查看配置文件可以,当用户在客户端访问homedir共享时候,调用的脚本为:/opt/VRTSnasgw/scripts/cifs_agent.sh home_precon %D %U;
N8300D1_01:/var/log # cat /etc/samba/smb.conf
[homes]
  browsable = no
        msdfs root = yes
        path = /var/lib/nfs/sm/links/LOCAL/%U
        root preexec = /opt/VRTSnasgw/scripts/cifs_agent.sh home_precon %D %U >> /opt/VRTSnasgw/log/cifs_homedir_log
#This file is automatically generated by script /opt/VRTSnasgw/scripts/cifs_agent.sh. Please donot modify it manually.
#gen_smb_Conf generated
#Date: Fri Mar 19 19:02:43 GMT-8 2010

[_home1$]
     path=/vx/data2/LOCAL/%U
     read only = no
                   root preexec = /opt/VRTSnasgw/scripts/cifs_agent.sh user_precon %D %U >> /opt/VRTSnasgw/log/cifs_homedir_log

3. 查看/opt/VRTSnasgw/scripts/cifs_agent.sh脚本,在function createhomedirlink ()
存在判断语句[ -L "$path/$username/$username" ] && return 0。这句话的意思是,如果存在link /var/lib/nfs/sm/links/LOCAL/zhu1/zhu1,那么就不会创建目录/vx/data2/LOCAL/zhu1。
function createhomedirlink ()
{
        ……………………………………………………………
        path="${linkdirpath}"
        [ ! -e "$path" ] && mkdir -p ${path}
        echo "mkdir -p ${path}" >> ${CIFSLOGFILE}
        path="${linkdirpath}/${domain_domainname}"
        echo "mkdir -p ${path}" >> ${CIFSLOGFILE}
        [ ! -e "$path" ] && mkdir -p ${path}
        echo "$path/$username/$username" >> ${CIFSLOGFILE}
        [ -L "$path/$username/$username" ] && return 0
         ……………………………………………………………
}

4. 我们可以看到,这个问题发生的根因在于当我们更改homedirfs的时候,没有删除/var/lib/nfs/sm/links下面的用户link信息。
建议与总结

END