I am trying to mount a password protected samba share.

When I access the share via smb://server/share in nautilus there is no password/user promt, it seems I am logged in as a guest and I can browse folders but I cannot access my files (which are in a subfolder that appears to be empty).

When I use nautilus GUI "connect to Server" prompt, I get back "Please verify your user details" although I am absolutely certain they are correct.

Note that I can access the share and my files without problem via

smbclient -U user //server/share

Also, using a MacOS machine I can also mount the shares without any problems.

So I try to mount the share via the commandline:

sudo mount -t cifs -o user=user //server/share  /mnt/sth

which produces

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

This seems to be a Kernel related bug: https://bugzilla.redhat.com/show_bug.cgi?id=832741.

So my question is: what's the simplest way to solve this? Did anyone experience something similar? Did a Kernel update solve it (at the redheat forums it seems to work for some but not for others). Am I doing something wrong?

I use linux mint xcfe 13, my Kernel version is 3.4.0.

EDIT: 20/2/2013, I still don't have a solution for this and appreciate any help.

  • Try sudo mount.cifs //server/share /mnt/sth -o username=youruser
    – jasonwryan
    Feb 11, 2013 at 17:30
  • @jasonwryan: according to man mount.cifs it should be user=, although in the credentials file it expects username= ... Feb 11, 2013 at 17:41
  • It works for me...
    – jasonwryan
    Feb 11, 2013 at 17:56
  • Still the same problem: mount error(22): Invalid argument
    – Tobias
    Feb 12, 2013 at 10:35

6 Answers 6


Try adding sec=ntlm to your option flags for mount, eg sudo mount -t cifs -o user=user,sec=ntlm //server/share /mnt/sth. Solved the same problem for me.

Source: https://bbs.archlinux.org/viewtopic.php?id=160047


try adding vers option on mount.for example:

sudo mount -t cifs -o user=user,vers=1.0 //server/share /mnt/sth

this worked for me using 4.13.4-1-ARCH


There is one thing that confuses me about your question. Mint is based on Ubuntu, which in turn is based on Debian. Why do you look at Redhat bugs then?

If you want to connect as a guest, tell mount so by passing the option guest, i.e. mount -o guest .... Otherwise it'll assume credentials are needed.

If you absolutely have to give the password on the command line, keep in mind to escape any special characters such as \ or $, because otherwise you end up a password that's different from what the server expects.

However, I cannot recommend using the approach presented in the other answer for a single reason: fstab is usually world-readable. Therefore you'd leak your credentials. The better method is to use the following method:

  1. in fstab add a line that contains credentials=/etc/share-credentials.txt in the options part. E.g. //server/share /mnt/point cifs iocharset=utf8,rw,credentials=/etc/share-credentials.txt,file_mode=0660,dir_mode=0770 0 0
  2. create a file for the credentials like this: touch /etc/share-credentials.txt && chmod u=rw,g=r,o= /etc/share-credentials.txt and then edit it.
  3. the file needs password and username for the share.

The format for the credentials file looks like this:


The domain value is optional.

  • Thank you for your answer. Unfortunately adding the line to fstab does not help, I get the same error (22). I was doing a google search for the error. In the redhat bug entry it says that this is a kernel issue, so I assumed that it is the same problem that I have and that's why I mentioned it here.
    – Tobias
    Feb 11, 2013 at 17:23

I had the same issue, and noticed that it failed under Linux Mint 18.3 Sylvia, but worked under Ubuntu 16.04.6 LTS.

What worked for me using vers=2.0,sec=ntlmssp along with the other options rather than the old vers=2.0,sec=ntlm


Really old issue that still arises with raspberry pi in my case.

Using UNC would default to IPv6 and fail, so using the IPv4 address instead of UNC fixed the problem.


mount.cifs //IPv4_ADDRESS/servicename mount_directory


mount.cifs -o ip=IPv4_ADDRESS //NETBIOS_name/service_name mount_directory

creating a lmhosts (man lmhosts) file in /etc/samba/ should fix this but did nothing in my case.

Also: make sure you type ntlm and not nltm .......


Just open /etc/fstab and paste
//server/share /mnt/sth/ cifs uid=uid,user=user,password=password 0 0
save it and type mount -a

  • Thank you, but this also produces "mount error(22): Invalid argument" once I try to mount.
    – Tobias
    Feb 11, 2013 at 17:19

You must log in to answer this question.

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