16

I want to check the dialect version in SMB connections.

On Windows, Get-SmbConnection will get it.

PS C:\Windows\system32> Get-SmbConnection ServerName ShareName UserName Credential Dialect NumOpens ---------- --------- -------- ---------- ------- ------- savdal08r2 c$ SAVILLTEC... SAVILLTEC... 2.10 1 savdalfs01 c$ SAVILLTEC... SAVILLTEC... 3.00 1 

on macOS, smbutil statshares -a works well.

What should I do on linux?

1
  • I forgot to explain that linux is a client and I mount the samba server with mount.cifs -o user=xxx...... Commented Oct 30, 2018 at 5:01

3 Answers 3

16

If you are running a Samba server on Linux, smbstatus should show the protocol version used by each client.

If Linux is the client, it depends on which client you're using: if you're using the kernel-level cifs filesystem support, in all but quite new kernels, the answer was that you look into /proc/mounts to see if the mount options for that filesystem include a vers= option; if not, assume it uses SMB 1.

SMB protocol autonegotiation in kernel-level CIFS/SMB support is rather recent development, and as far as I know, if you don't specify the protocol version you want, the autonegotiation will only indicate the result if you enable CIFS debug messages. but fortunately the developers made it so the negotiation result will always be shown in /proc/mounts.

If you use smbclient or other userspace SMB/CIFS clients (e.g. one integrated to your desktop environment), then it might have its own tools and diagnostics.

8
  • 1
    The mount points show the version negotiated by default as far as I am aware, have a look at unix.stackexchange.com/questions/367884/… Commented Oct 29, 2018 at 19:24
  • Thanks,I forgot to explain that linux is a client.i look into the manual of smbstatus cifs-util and find nothing.I didn't expect it to exist in the mount. Commented Oct 30, 2018 at 4:58
  • 1
    "if the mount options for that filesystem include a vers= option; if not, assume it uses SMB 1". Do you happen to have a reference for this statement? For example, on wiki.samba.org/index.php/LinuxCIFSKernel, I find this seemingly contradictory statement: "For improved security and performance, SMB3 is the now the default dialect (SMB3.1.1/SMB3.02/SMB3/SMB2.1 dialects are requested by default)." Commented May 6, 2020 at 5:32
  • 3
    @bers If the cifs filesystem supports autonegotiation, it will always show the vers= option according to the actual version negotiated, in /proc/mounts. If that option is not there, you're dealing with an old kernel that cannot autonegotiate and very likely defaults to SMB 1. In kernel.org Git logs the default was changed in 2017-07-08 and autonegotiation was added after that in 2017-09-17. Distributions may or may not have backported those patches both at once to their kernel pkgs. Commented May 6, 2020 at 10:11
  • 2
    My /proc/mounts (Ubuntu 22.04) keeps showing vers=default. But the actual dialect negotiated / used can be queried via /proc/fs/cifs/DebugData. Commented Aug 31, 2022 at 14:53
10

You can use a script that comes with nmap. nmap/Zenmap(GUI) will allow you to scan a single device or subnet range (your home or office network) and try and show you what SMB protocols are in use.

nmap --script smb-protocols 192.168.1.0/24 

The big point here is to cease using SMBv1 due to security concerns. It's also known as 'NT LM 0.12' Zenmap is available for most major platforms.

2
  • This shows SMB versions offered by the server, but not the actual SMB version used by an actual client-server connection. Commented May 6, 2020 at 5:30
  • This is what I needed! Had to add -Pn but then it showed: Host script results: | smb-protocols: | dialects: | 2.02 | 2.10 | 3.00 | 3.02 |_ 3.11 Commented Dec 5, 2023 at 16:04
2

Use smbstatus >>

https://www.samba.org/samba/docs/current/man-html/smbstatus.1.html

Example Output:

[root@server~]# smbstatus --shares Service pid Machine Connected at Encryption Signing --------------------------------------------------------------------------------------------- PubRO 26900 192.168.1.255 Thu Oct 25 12:43:51 AM 2018 PDT - - 
1
  • How does smbstatus determine the CMB version that's in use? Commented Aug 9, 2021 at 22:54

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.