We are using Fedora 26 with the 4.13.9 kernel and NIS, and I'm aware of the issue where the default CIFS/Samba version is now 3.0. However we use an older Drobo FS which their support says only works with SMB version 1.0. We do not put the Drobo in /etc/fstab
as it will fail on boot some times so we use autofs/automount. We have a cron job that runs and should be calling /etc/auto.cifs
and note the contents of the config files below. I added vers=1.0
every where I could think of. The below results of the ypcat -k
command shows the option does not appear to be passed to the mount
command. Am I missing a config file some where? I've grepped all of /etc
to find all occurrences of mount
or CIFS but nothing except comments come back. Perhaps I'm missing something that isn't obvious to me but might be for someone reading this...
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 }
'
And here's:
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 }
'
However when running:
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
Here are some debug autofs logs:
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 (e.g. 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 (e.g. 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
adding fstab contents:
cat /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
I found where to add the
vers=1.0
option. On the primary NIS server we have a couple files for both Drobo units for each campus:But the other thing that escaped me was I had to run
make -C /var/yp
after making a change to the above file, and then the other workstations/servers in the NIS domain starting seeing the change.Also a change was made in cifs-utils to documentation, and a small bugfix in setcifsacl.