挂载错误没有指定方言,在哪里设置vers = 1.0与autofs / Fedora 26,Drobo FS

我们使用Fedora 26和4.13.9内核和NIS,并且我知道默认的CIFS / Samba版本现在是3.0的问题 。 然而,我们使用一个较老的Drobo FS,他们的支持只适用于SMB版本1.0。 我们不把Drobo放在/etc/fstab因为它在启动时会失败,所以我们使用autofs / automount。 我们有一个运行的cron作业,应该调用/etc/auto.cifs并记下下面的configuration文件的内容。 我在每个我能想到的地方加上vers=1.0 。 以下ypcat -k命令的结果显示该选项似乎不会传递给mount命令。 我在哪里丢失了一个configuration文件? 我已经grepped所有的/etcfind所有的mount或CIFS的事件,但除了意见回来。 也许我错过了一些对我来说不明显的东西,但可能是有人读这个…

 cat /etc/auto.cifs #!/bin/bash # Automount config file for drobo network storage device # # This file must be executable to work! chmod 755! key="$1" # Note: create a cred file for each windows/Samba-Server in your network # which requires password authentification. The file should contain # exactly two lines: # username=user # password=***** # Please don't use blank spaces to separate the equal sign from the # user account name or password. credfile="/etc/auto.smb.$key" # Note: Use cifs instead of smbfs: mountopts="-fstype=cifs,vers=1.0,file_mode=0600,dir_mode=0700,uid=root,gid=root,wsize=8192" smbclientopts="-m SMB1" for P in /bin /sbin /usr/bin /usr/sbin do if [ -x $P/smbclient ] then SMBCLIENT=$P/smbclient break fi done [ -x $SMBCLIENT ] || exit 1 if [ -e "$credfile" ] then mountopts=$mountopts"vers=1.0,credentials=$credfile" smbclientopts="-A "$credfile else smbclientopts="-N" fi $SMBCLIENT $smbclientopts -gL $key 2>>/var/log/autofs.log \ | awk -v key="$key" -v opts="$mountopts" -F'|' -- ' BEGIN { ORS=""; first=1 } /Disk/ { if (first) { print opts; first=0 }; gsub(/ /, "\\ ", $2); sub(/\$/, "\\$", $2); print " \\\n\t /" $2, "://" key "/" $2 } END { if (!first) print "\n"; else exit 1 } ' 

这里是:

 cat /etc/auto.smb #!/bin/bash # This file must be executable to work! chmod 755! # Automagically mount CIFS shares in the network, similar to # what autofs -hosts does for NFS. # Put a line like the following in /etc/auto.master: # /cifs /etc/auto.smb --timeout=300 # You'll be able to access Windows and Samba shares in your network # under /cifs/host.domain/share # "smbclient -L" is used to obtain a list of shares from the given host. # In some environments, this requires valid credentials. # This script knows 2 methods to obtain credentials: # 1) if a credentials file (see mount.cifs(8)) is present # under /etc/creds/$key, use it. # 2) Otherwise, try to find a usable kerberos credentials cache # for the uid of the user that was first to trigger the mount # and use that. # If both methods fail, the script will try to obtain the list # of shares anonymously. get_krb5_cache() { cache= uid=${UID} for x in $(ls -d /run/user/$uid/krb5cc_* 2>/dev/null); do if [ -d "$x" ] && klist -s DIR:"$x"; then cache=DIR:$x return fi done if [ -f /tmp/krb5cc_$uid ] && klist -s /tmp/krb5cc_$uid; then cache=/tmp/krb5cc_$uid return fi } key="$1" opts="-fstype=cifs -m SMB1" for P in /bin /sbin /usr/bin /usr/sbin do if [ -x $P/smbclient ] then SMBCLIENT=$P/smbclient break fi done [ -x $SMBCLIENT ] || exit 1 creds=/etc/creds/$key if [ -f "$creds" ]; then opts="$opts"',vers=1.0,uid=$UID,gid=$GID,credentials='"$creds" smbopts="-A $creds" else get_krb5_cache if [ -n "$cache" ]; then opts="$opts"',vers=1.0,multiuser,cruid=$UID,sec=krb5i' smbopts="-k" export KRB5CCNAME=$cache else opts="$opts"',vers=1.0,guest' smbopts="-N" fi fi $SMBCLIENT $smbopts -gL "$key" 2>/dev/null| awk -v "key=$key" -v "opts=$opts" -F '|' -- ' BEGIN { ORS=""; first=1 } /Disk/ { if (first) print opts; first=0 dir = $2 loc = $2 # Enclose mount dir and location in quotes # Double quote "$" in location as it is special gsub(/\$$/, "\\$", loc); gsub(/\&/,"\\\\&",loc) print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\"" } END { if (!first) print "\n"; else exit 1 } ' 

但是在运行时:

 ypcat -k auto.cifs $SMBCLIENT $smbclientopts -gL $key 2>>/var/log/autofs.log | awk -v key="$key" -v opts="$mountopts" -F'|' -- ' [ -x $SMBCLIENT ] || exit 1 credfile="/etc/auto.smb.$key" do done else fi for P in /bin /sbin /usr/bin /usr/sbin if [ -e "$credfile" ] key="$1" mountopts="fstype=cifs,file_mode=0600,dir_mode=0700,uid=root,gid=root" smbclientopts="" then 

这里有一些debug autofs日志:

 Oct 31 16:12:20 workstation automount[5234]: handle_packet_missing_indirect: token 508, name drobo-down, request pid 10165 Oct 31 16:12:20 workstation automount[5234]: attempting to mount entry /drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: lookup_mount: lookup(yp): looking up drobo-down Oct 31 16:12:20 workstation automount[5234]: lookup_mount: lookup(yp): drobo-down -> -fstype=cifs,rw,user,suid,credentials=/etc/auto.smb.drobo-up ://drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: parse_mount: parse(sun): expanded entry: -fstype=cifs,rw,user,suid,credentials=/etc/auto.smb.drobo-up ://drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: parse_mount: parse(sun): gathered options: fstype=cifs,rw,user,suid,credentials=/etc/auto.smb.drobo-up Oct 31 16:12:20 workstation automount[5234]: parse_mount: parse(sun): dequote("://drobo-up/drobo-down") -> ://drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: parse_mount: parse(sun): core of entry: options=fstype=cifs,rw,user,suid,credentials=/etc/auto.smb.drobo-up, loc=://drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: sun_mount: parse(sun): mounting root /drobo-up, mountpoint drobo-down, what //drobo-up/drobo-down, fstype cifs, options rw,user,suid,credentials=/etc/auto.smb.drobo-up Oct 31 16:12:20 workstation automount[5234]: do_mount: //drobo-up/drobo-down /drobo-up/drobo-down type cifs options rw,user,suid,credentials=/etc/auto.smb.drobo-up using module generic Oct 31 16:12:20 workstation automount[5234]: mount_mount: mount(generic): calling mkdir_path /drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: mount_mount: mount(generic): calling mount -t cifs -o rw,user,suid,credentials=/etc/auto.smb.drobo-up //drobo-up/drobo-down /drobo-up/drobo-down Oct 31 16:12:20 workstation kernel: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (eg SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount. Oct 31 16:12:20 workstation automount[5234]: >> mount error(112): Host is down Oct 31 16:12:20 workstation automount[5234]: >> Refer to the mount.cifs(8) manual page (eg man mount.cifs) Oct 31 16:12:20 workstation kernel: CIFS VFS: cifs_mount failed w/return code = -112 Oct 31 16:12:20 workstation automount[5234]: mount(generic): failed to mount //drobo-up/drobo-down (type cifs) on /drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: dev_ioctl_send_fail: token = 508 Oct 31 16:12:20 workstation automount[5234]: failed to mount /drobo-up/drobo-down Oct 31 16:12:20 workstation automount[5234]: handle_packet: type = 3 Oct 31 16:12:20 workstation automount[5234]: handle_packet_missing_indirect: token 509, name drobo-down, request pid 10182 Oct 31 16:12:20 workstation automount[5234]: dev_ioctl_send_fail: token = 509 Oct 31 16:12:20 workstation automount[5234]: handle_packet: type = 3 Oct 31 16:12:20 workstation automount[5234]: handle_packet_missing_indirect: token 510, name drobo-down, request pid 10165 Oct 31 16:12:20 workstation automount[5234]: dev_ioctl_send_fail: token = 510 

添加fstab内容:

猫/ etc / fstab

 # # /etc/fstab # Created by anaconda on Tue Aug 16 10:22:50 2011 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/vg_server-LogVol00 / ext4 defaults 1 1 UUID=01bbe54b-06d4-4537-aa87-9c9618996000 /boot ext4 defaults 1 2 /dev/mapper/vg_server-LogVol02 /home ext4 defaults 1 2 /dev/mapper/vg_server-LogVol03 /usr/local ext4 defaults 1 2 /dev/mapper/vg_server-LogVol01 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 

我发现在哪里添加vers=1.0选项。 在主要的NIS服务器上,我们为每个校园的Drobo设备都有一对文件:

 cat /etc/auto.drobo-uptown drobo-downtown -fstype=cifs,vers=1.0,rw,user,suid,credentials=/etc/auto.smb.drobo-uptown ://drobo-uptown/drobo-downtown 

但是另外一个让我感到make -C /var/yp是,在对上述文件进行更改之后,我不得不运行make -C /var/yp ,然后NIS域中的其他工作站/服务器开始看到更改。

另外,在cifs-utils中对文档进行了更改,并在setcifsacl中进行了小小的修正 。