27

Unlike the similar question, I cannot even connect with smbclient.

The samba share works fine in windows and automagically works, but in Linux I can't mount it at all and the error message is cryptic at best. Here is my samba.conf:

[global]
    dos charset = CP437
    netbios name = REDACTED
    server string = Lab
    server role = standalone server
    map to guest = Bad User
    obey pam restrictions = Yes
    smb passwd file = /var/etc/private/smbpasswd
    private dir = /var/etc/private
    max log size = 51200
    server min protocol = SMB2
    time server = Yes
    deadtime = 15
    max open files = 11070
    hostname lookups = Yes
    load printers = No
    printcap name = /dev/null
    disable spoolss = Yes
    dns proxy = No
    pid directory = /var/run/samba
    panic action = /usr/local/libexec/samba/samba-backtrace
    idmap config * : backend = tdb
    acl allow execute always = Yes
    create mask = 0666
    directory mask = 0777
    directory name cache size = 0
    kernel change notify = No
    map archive = No
    map readonly = no
    store dos attributes = Yes
    strict locking = No

[common]
    comment = Lab Common share
    path = /mnt/pool/common
    read only = No
    inherit acls = Yes
    hosts allow = XXX.XXX.XX.X/24, XXX.XX.XX.X/24 <-- redacted
    hide dot files = No
    veto files = /.snap/.windows/.zfs/
    vfs objects = zfsacl, streams_xattr, aio_pthread
    zfsacl:acesort = dontcare
    nfs4:chown = yes
    nfs4:acedup = merge
    nfs4:mode = special
    recycle:subdir_mode = 0700
    recycle:directory_mode = 0777
    recycle:touch = yes
    recycle:versions = yes
    recycle:keeptree = yes
    recycle:repository = .recycle/%U

The error message is:

[as@localhost ~]$ sudo mount -t cifs -o username=removed,password=removed  //server.ip.address/common /media/windowsshare/
mount error(95): Operation not supported

A perfectly useless message.

The debug-enabled dmesg:

[237179.795551] fs/cifs/cifsfs.c: Devname: //132.239.27.172/common flags: 0
[237179.795563] fs/cifs/connect.c: Username: lauria
[237179.795565] fs/cifs/connect.c: file mode: 0x1ed  dir mode: 0x1ed
[237179.795600] fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 44 with uid: 0
[237179.795600] fs/cifs/connect.c: UNC: \\132.239.27.172\common
[237179.795605] fs/cifs/connect.c: Socket created
[237179.795606] fs/cifs/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x1b58
[237179.795897] fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0xffff8803e0aa4800/0xffff880035d25580)
[237179.795898] fs/cifs/connect.c: Demultiplex PID: 25817
[237179.795902] fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 45 with uid: 0
[237179.795903] fs/cifs/connect.c: Existing smb sess not found
[237179.795907] fs/cifs/cifssmb.c: Requesting extended security.
[237179.795910] fs/cifs/transport.c: For smb_command 114
[237179.795912] fs/cifs/transport.c: Sending smb: smb_len=78
[237179.801062] fs/cifs/connect.c: RFC1002 header 0x25
[237179.801067] fs/cifs/misc.c: checkSMB Length: 0x29, smb_buf_length: 0x25
[237179.801090] fs/cifs/transport.c: cifs_sync_mid_result: cmd=114 mid=1 state=4
[237179.801093] fs/cifs/cifssmb.c: Dialect: 65535
[237179.801094] fs/cifs/cifssmb.c: negprot rc -95
[237179.801097] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 45) rc = -95
[237179.801100] fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0xffff8803e0aa4800/0xffff880035d25580)
[237179.801262] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 44) rc = -95
[237179.801263] CIFS VFS: cifs_mount failed w/return code = -95

I have tried many different -sec options---they all fail, everything has the same error message. smbclient is not helpful either:

smbclient //132.239.27.172/common -U username%password
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE

How does this work on windows but not at all on linux?

6 Answers 6

34

To fill out the answers from @Ken and @Paul: The SMB version needs to be specified when higher than v1:

mount -t cifs \
  -o username=USERNAME,vers=3.0 \
  //server/share \
  /mnt/point

The Linux cifs kernel client has been included in the kernel since 2.5.42. The cifs protocol (and related earlier SMB dialects) is the default ("vers=1.0") but support for newer dialects (SMB2.02, SMB2.1 and SMB3 and SMB3.02) can be selected by specifying "vers=2.0" or "vers=2.1" or "vers=3.0" or "vers=3.02" on mount. -- https://wiki.samba.org/index.php/LinuxCIFSKernel

For smbclient the incantation is -m, --max-protocol=LEVEL:

smbclient -L server -U username -m SMB2

I didn't find a list of the allowed levels for smbclient. According to Marc Muehlfeld in this thread the versions used by Windows are:

  • SMB 2.0 was introduced by Vista/2008
  • SMB 2.1 by Win7/2008R2
  • SMB 2.2 aka 3.0 by Win8/2012
  • SMB 3.02 by 8.1/2012R2

There are several different mount error messages which can be traced back to the mismatched protocol level. A non-exhaustive list (feel free to edit the answer and add more):

mount error(13): Permission denied
mount error(95): Operation not supported
mount error(121): Remote I/O error

Finally, I've seen some comments that indicate the often-quoted advice to use the option sec=ntlmv2 and similar shouldn't be followed anymore. So probably a good idea to at least not mix and match sec and vers.

4
  • It may be a new machine, for me vers=3.0 did not work but vers=3.02 did, thanks.
    – dashesy
    Feb 2, 2018 at 22:45
  • 8
    And in my case the only one I could get to work was vers=2.0 (Ubuntu 18.04) May 3, 2018 at 22:16
  • 3
    Same experience with Ubuntu 18.04; be sure to try all possible SMB versions.
    – Jay Taylor
    Apr 22, 2019 at 23:01
  • not sure if relevant but this is how I found smb protocol version for network drive, I used 'nmap' nmap -p445 --script smb-protocols <target> Source : serverfault.com/questions/378732/…
    – Dexobox
    Nov 17, 2022 at 23:03
13

OK "I" figured it out-- for some reason, adding "vers=3.0" makes it work. I don't know why it was having issues without this, or why it works. but for future reference if others are having this issue with their freenas setups.

4
  • 3
    adding vers=3.0 to what ? Please assist
    – khaverim
    Jan 17, 2018 at 21:11
  • 1
    I think paul meant to mount options.
    – BHS
    May 18, 2018 at 0:11
  • 5
    vers=1.0 worked for me
    – Bilow
    Aug 2, 2018 at 12:15
  • @khaverim He means to use this command instead: sudo mount -t cifs -o username=removed,password=removed,vers=3.0 //server.ip.address/common /media/windowsshare/ Mar 14, 2021 at 17:36
6

I have been fighting this for over a month now. With client being Xenserver 6.2 and 6.5, cannot mount ISO directory over CIFS.

The vers=3.0 finally worked.

Where did you find this option??!

My domain is Windows 2012 R2. I did not lower the authentication requirements in the registry - they are all default still (I was just about to open it up wide when I found this).

I did not have to specify a sec= setting at all.

I DID have to specify a domain. I specified domain in caps - may not be needed though.

My command follows.

mount -t cifs "//192.168.92.25/shared" -o username=administrator,password=<your_password>,domain=<YOUR DOMAIN IN CAPS>,vers=3\.0 /root/tmp

Now to figure out how to add options to the authentication.

Thanks Paul, whoever you are.

1
  • 3\.0 did not work for me, but 3.0 did.
    – trpt4him
    Oct 29, 2018 at 17:24
0

FreeNas allows you to set up more secure shares. If you allow the lowest windows security protocols (windows NT 4.0) it will work with samba. If you have it set to, say Windows XP protocols and above you reuqire the vers=3.0 as I discovered after struggling for 40 minutes to get the FreeNas connecte wiv CentOS 7. The problem is the clients (and GUI) should be checking the highest version down. Instead it goes from the lowest version available. It may have made sense once but much has changed. I think it's especially annoying that in Gnome you can't add options, either for using CIFS or for specifying security protocol versions. I guess they figure for these people it's command-line or nothing, but that keeps Linux from being used more widely by desktop uses. which is a shame really.

0

What I found that worked for me was to remove vers=3.0 and use sec=ntlmv2 instead. This reaffirm what "@matt wilkie" said.

So my line looks like this in /etc/fstab

//<server>/<share> /mnt/point cifs sec=ntlmv2,iocharset=utf8,credential=/.smbcredentials 0 0
-1

on nas4free click service -> CIFS/SMB at the bottom of the screen in the Additional Parameters box type

ntlm auth = yes

1
  • What is nas4free and how does it relate to OPs question?
    – jesse_b
    May 11, 2019 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.