I’ve been mounting Windows Shares on Linux servers for years and until recently I’ve noticed an issue with this — Some files/directories are not listed from a Windows share.
I’ve searching the internet and people are experiencing the same problem as well. It looks like a kernel bug for SMBv2+ according to the discussions below:
- https://bugs.centos.org/view.php?id=15829
- https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1572132
For systems I’ve been working on, the changes are both Windows and Linux have been upgraded — SMBv1 is not supported anymore between them. In 2017 Microsoft patched Windows Servers and advised to disable the SMBv1 protocol for security reasons. That explains why I didn’t notice it before.
On a Linux box, command “modinfo cifs” will display CIFS module info at the kernel level:
root@joetest:~/# modinfo cifs
filename: /lib/modules/4.1.12-124.48.6.el6uek.x86_64/kernel/fs/cifs/cifs.ko
version: 2.06
description: VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
license: GPL
author: Steve French <sfrench@us.ibm.com>
alias: fs-cifs
srcversion: 4CFC8FAABB534357A689526
depends: dns_resolver
retpoline: Y
intree: Y
vermagic: 4.1.12-124.48.6.el6uek.x86_64 SMP mod_unload modversions
parm: CIFSMaxBufSize:Network buffer size (not including header). Default: 16384 Range: 8192 to 130048 (uint)
parm: cifs_min_rcv:Network buffers in pool. Default: 4 Range: 1 to 64 (uint)
parm: cifs_min_small:Small network buffers in pool. Default: 30 Range: 2 to 256 (uint)
parm: cifs_max_pending:Simultaneous requests to server. Default: 32767 Range: 2 to 32767. (uint)
parm: enable_oplocks:Enable or disable oplocks. Default: y/Y/1 (bool)
And if cifs-utils package is installed, manpage of mount.cifs can be checked with “man 8 mount.cifs”
root@joetest:~/# yum info cifs-utils
Loaded plugins: security
epel/metalink | 3.8 kB 00:00
local_ol6_latest | 2.9 kB 00:00 ...
ol6_latest | 2.7 kB 00:00
Installed Packages
Name : cifs-utils
Arch : x86_64
Version : 4.8.1
Release : 20.el6
Size : 135 k
Repo : installed
From repo : local_ol6_latest
Summary : Utilities for mounting and managing CIFS mounts
URL : http://linux-cifs.samba.org/cifs-utils/
License : GPLv3
Description : The SMB/CIFS protocol is a standard file sharing protocol widely deployed
: on Microsoft Windows machines. This package contains tools for mounting
: shares on Linux using the SMB/CIFS protocol. The tools in this package
: work in conjunction with support in the kernel to allow one to mount a
: SMB/CIFS share onto a client and use it as if it were a standard Linux
: file system.
On Windows side, the article from Microsoft explains how to check, disable & enable a specific version of SMB using powershell.
For examples:
PS C:\Windows\system32> Get-WindowsOptionalFeature -Online -FeatureName smb1protocol
FeatureName : SMB1Protocol
DisplayName : SMB 1.0/CIFS File Sharing Support
Description : Support for the SMB 1.0/CIFS file sharing protocol, and the Computer Browser protocol.
RestartRequired : Possible
State : Disabled
CustomProperties :
ServerComponent\Description : Support for the SMB 1.0/CIFS file sharing protocol, and the Computer Browser protocol.
ServerComponent\DisplayName : SMB 1.0/CIFS File Sharing Support
ServerComponent\Id : 487
ServerComponent\Type : Feature
ServerComponent\UniqueName : FS-SMB1
ServerComponent\Deploys\Update\Name : SMB1Protocol
PS C:\Users\Administrator> Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol
Do you want to restart the computer to complete this operation now?
[Y] Yes [N] No [?] Help (default is "Y"): N
Path :
Online : True
Restart Needed : True
PS C:\Users\Administrator> Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
Do you want to restart the computer to complete this operation now?
[Y] Yes [N] No [?] Help (default is "Y"): N
Path :
Online : True
Restart Needed : True
Using Get-SmbServerConfiguration / Set-SmbServerConfiguration for EnableSMB1Protocol/EnableSMB2Protocol/ EnableSMB3Protocol which doesn’t need a restart of the server.
Get-SmbServerConfiguration | Select EnableSMB2Protocol
Set-SmbServerConfiguration -EnableSMB2Protocol $false
Set-SmbServerConfiguration -EnableSMB2Protocol $true