8

Mounting a samba share (from linux samba server) is not possible from shell on fresh kubuntu 19.04 installation

root@client:~# mount -t cifs -o user=myuser //myserver/myshare /home/user/myserver/myshare/
Password for myuser@//myserver/myshare:  *****
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

But the share, mountpoint and user (credentials) exist and are correct:

smbclient -L myserver -U mygroup\\myuser
Enter MYGROUP\MYUSER's password: 

    Sharename       Type      Comment
    ---------       ----      -------
    myshare         Disk      
    [...]

~# ls -al /home/user/myserver/myshare/
insgesamt 8
drwxrwxrwx 2 user user 4096 Jul 30 19:21 .
drwxrwxr-x 3 user user 4096 Jul 30 19:21 ..

I can also open the share in e.g. dolphin with smb:// protocol This used to work for years now with previous ubuntu versions.

client system:

~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:        19.04
Codename:       disco

~# uname -a
Linux mypc 5.0.0-21-generic #22-Ubuntu SMP Tue Jul 2 13:27:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

installed packages (from apt log):

install cifs-utils:amd64 <keine> 2:6.8-2
install keyutils:amd64 <keine> 1.6-6
install samba-common:all <none> 2:4.10.0+dfsg-0ubuntu2.2
install smbclient:amd64 <keine> 2:4.10.0+dfsg-0ubuntu2.2

Server samba version:

~# smbd --version
Version 3.6.25

6 Answers 6

18

This is just a guess because I don't remember what the default settings were on Samba 3.6 but I think CIFS is trying to mount with an smb dialect that that version of samba didn't have yet.

Add the parameter vers=1.0 or maybe vers=2.0 to your list and see if you can connect:

mount -t cifs -o user=myuser,vers=1.0 //myserver/myshare /home/user/myserver/myshare/

EDIT: You may have to drop down the security level as well with another parameter: sec=ntlm

4
  • 1
    Perfect! The "vers=1.0" did it! Fun fact: I recently had to specify version 3.0 to mount a windows server 2019 share from linux... anyway, that error message is a real cheek!
    – Peter
    Jul 30, 2019 at 23:10
  • i already tried with using vers and sec=ntlm and tons of other combinations to no avail, nothing works for me. no idea what kind of share is implemented, i try to get epson printer share working. using smbclient \\ip\share works with empty credentials, i can browse the share with no issues that way
    – tymik
    Jun 21, 2020 at 20:26
  • I'm in the same situation: vers=1.0 and sec=ntlm don't help at all. While with smbclient I'm able to list the shared directories. Any solutions?
    – vvaltchev
    Jul 15, 2020 at 11:47
  • vers=1.0 worked for me
    – zszep
    Aug 30, 2021 at 7:33
2

Try to install the package keyutils, it solved for me:

sudo apt-get install keyutils

(I've seen it here: https://unix.stackexchange.com/a/507464/472671)

1
  • didn't work for me :( Feb 21, 2022 at 5:52
0

I had to install the cifs-utils package:

sudo apt-get install cifs-utils
0

Similar to the suggestions in this answer, you may need to define the SMB protocol version.

In my case, I could use vers=default even though the manpages indicate that this is what is supposed to be used when nothing is defined.

sudo mount -t cifs -o username=yourusername,vers=default //servername/sharepath/ /mnt/mountpoint/

Here is the complete list of version numbers accepted by the vers= argument according to man mount.cifs:

SMB protocol version. Allowed values are:

• 1.0 - The classic CIFS/SMBv1 protocol.

• 2.0 - The SMBv2.002 protocol. This was initially introduced in Windows Vista Ser‐
 vice Pack 1, and Windows Server 2008. Note that the initial  release  version  of
 Windows Vista spoke a slightly different dialect (2.000) that is not supported.

• 2.1 - The SMBv2.1 protocol that was introduced in Microsoft Windows 7 and Windows
 Server 2008R2.

• 3.0 - The SMBv3.0 protocol that was introduced in Microsoft Windows 8 and Windows
 Server 2012.

• 3.02  or  3.0.2 - The SMBv3.0.2 protocol that was introduced in Microsoft Windows
 8.1 and Windows Server 2012R2.

• 3.1.1 or 3.11 - The SMBv3.1.1 protocol that was introduced in  Microsoft  Windows
 10 and Windows Server 2016.

• 3 - The SMBv3.0 protocol version and above.

• default  -  Tries  to  negotiate  the highest SMB2+ version supported by both the
 client and server.

If no dialect is specified on mount vers=default is used.  To check  Dialect  refer
to /proc/fs/cifs/DebugData

Note too that while this option governs the protocol version used, not all features
of each version are available.

The default since v4.13.5 is for the client and server  to  negotiate  the  highest
possible  version  greater than or equal to 2.1. In kernels prior to v4.13, the de‐
fault was 1.0. For kernels between v4.13 and v4.13.5 the default is 3.0.
111
0

I'm a newb, but here I go... I was trying to mount a NAS cifs share on Ubuntu server and found that I didn't have to use cifs at all - I could use smb3 directly. From the man mount.cifs

mount.smb3 mounts only SMB3 filesystem. It is usually invoked indirectly by the mount(8) command when using the "-t smb3" option. The smb3 filesystem type was added in kernel-4.18 and above. It works in a similar fashion as mount.cifs except it passes filesystem type as smb3.

I know it's not secure, but I was having trouble referencing a .credentials file, so in my case, this got the job done for the moment: mount -t smb3 //192.168.68.57/SFX /mnt/nas_mount -o username=user,password=pass,workgroup=WORKGROUP,iocharset=utf8

0

I tried to mount a network drive with Windows OS on Ubuntu from one subnet to another, I got the same error. "mount error(2): No such file or directory Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)" in the logs the error was: "cifs_mount failed w/return code = -2" The problem was in the firewall on Windows with a shared disk. I wrote a rule for access from another subnet to incoming traffic and this eliminated this error. I note that "cifs-utils" and "keyutils" were already installed.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Jan 29 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .