Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

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

3 Answers

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

share|improve this answer
    
Thank you, but this also produces "mount error(22): Invalid argument" once I try to mount. –  Tobias Feb 11 '13 at 17:19
add comment

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:

username=johndoe
password=sekrit
domain=foobar

The domain value is optional.

share|improve this answer
    
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 '13 at 17:23
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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