Ubuntu Server 18.04.01 LTS CIFS Mount failing

7,743

Solution 1

Remove sec=ntlm. That hasn't worked for a few versions now, but it's still in lots of tutorials around the interwebs.

Solution 2

It's not that sec=ntlm no longer works. That setting is inconsistent with the version of the samba dialect you are using however.

I have an Ubuntu 18.04 Samba server set up. If I try to mount with your settings:

sudo mount -t cifs //gort.local/Public /home/morbius/Test -o guest,vers=3.0,sec=ntlm

It fails with the exact "Invalid argument" error message and logs the exact same errors.

If instead I run the mount command with a version of the smb dialect consistent with that security setting:

sudo mount -t cifs //gort.local/Public /home/morbius/Test -o guest,vers=1.0,sec=ntlm

It does work:

mount | grep cifs

//gort.local/Public on /home/morbius/Test type cifs (rw,relatime,vers=1.0,sec=ntlm,cache=strict ....

If you want to connect to the server with sec=ntlm change to vers=1.0 - I don't know why you would want or need to do that but .....

Or keep vers=3.0 and drop sec=ntlm in which case sec defaults to ntlmssp which is consistant with SMBv3.

Share:
7,743
Spencer Skinner
Author by

Spencer Skinner

Updated on September 18, 2022

Comments

  • Spencer Skinner
    Spencer Skinner over 1 year

    Having issues getting my persistent network shares to mount in Ubuntu, here is what ive added to /etc/fstab

    //192.168.2.10/AlphaData_GlobalShare  /media/AlphaData  cifs  credentials=/root/.smbcredentials,iocharset=utf8,uid=1001,gid=1001,vers=3.0,sec=ntlm  0  0
    //192.168.2.10/AlphaMedia_GlobalShare  /media/AlphaMedia  cifs  credentials=/root/.smbcredentials,iocharset=utf8,uid=1001,gid=1001,vers=3.0,sec=ntlm  0  0
    //192.168.2.10/VMRoot_GlobalShare  /media/VMRoot  cifs 
    credentials=/root/.smbcredentials,iocharset=utf8,uid=1001,gid=1001,vers=3.0,sec=ntlm  0  0
    

    Here is the error i get for sudo mount -a

    mount error(22): Invalid argument
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    mount error(22): Invalid argument
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    mount error(22): Invalid argument
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    

    And here are the logs

    Oct 20 09:49:20 ubuntudocker kernel: [ 2150.545771] CIFS VFS: cifs_mount failed w/return code = -22
    Oct 20 09:52:55 ubuntudocker kernel: [ 2365.006778] CIFS VFS: Unable to select appropriate authentication method!
    Oct 20 09:52:55 ubuntudocker kernel: [ 2365.006780] CIFS VFS: Send error in SessSetup = -22
    Oct 20 09:52:55 ubuntudocker kernel: [ 2365.007569] CIFS VFS: cifs_mount failed w/return code = -22
    Oct 20 09:53:00 ubuntudocker kernel: [ 2370.037292] CIFS VFS: Unable to select appropriate authentication method!
    Oct 20 09:53:00 ubuntudocker kernel: [ 2370.037294] CIFS VFS: Send error in SessSetup = -22
    Oct 20 09:53:00 ubuntudocker kernel: [ 2370.038419] CIFS VFS: cifs_mount failed w/return code = -22
    Oct 20 09:53:05 ubuntudocker kernel: [ 2375.077100] CIFS VFS: Unable to select appropriate authentication method!
    Oct 20 09:53:05 ubuntudocker kernel: [ 2375.077102] CIFS VFS: Send error in SessSetup = -22
    Oct 20 09:53:05 ubuntudocker kernel: [ 2375.078377] CIFS VFS: cifs_mount failed w/return code = -22
    

    Not sure whats causing the issues here, the shares are hosted on a FreeNAS 11.2-RC1 server, same with the Ubuntu Server VM. Any idea whats causing the issue here?

    Thanks

  • Spencer Skinner
    Spencer Skinner over 5 years
    seems that removing sec=ntlm worked, its mounted properly, the issue ive now got is that when I try and make a directory its saying permission denied unless I use sudo mkdir. The mount details are the same as the ones I log in with on my windows machine which doesnt have any issues making directories. Any ideas? I feel like this is me being stupid on this one
  • Spencer Skinner
    Spencer Skinner over 5 years
    seems that removing sec=ntlm worked, its mounted properly, the issue ive now got is that when I try and make a directory its saying permission denied unless I use sudo mkdir. The mount details are the same as the ones I log in with on my windows machine which doesnt have any issues making directories. Any ideas? I feel like this is me being stupid on this one
  • Organic Marble
    Organic Marble over 5 years
    I struggled with this problem and I'm not sure I found the right answer. I made myself the owner of the directory that the share gets mounted into. I had a lot of trouble with ownership and permissions when I started setting up shares. It might be worth asking a new question.
  • Morbius1
    Morbius1 over 5 years
    Add another option to your fstab declaration: nounix as in //192.168.2.10/AlphaData_GlobalShare /media/AlphaData cifs credentials=/root/.smbcredentials,iocharset=utf8,uid=1001,gi‌​d=1001,vers=3.0,noun‌​ix 0 0