Disclaimer: I am very new to Linux :)

Anyway, onward:

I have a fresh instance of Ubuntu Server (12.04.1 LTS) running on my network and I want to mount a network drive to the server so I can access the contents. The network drive is a SAMBA compatible drive running Darwin OS.

If I run the following command:

smbclient -L // -U myuser

It prompts me for the password and then displays output similar to:

Domain=[SERVER01] OS=[Darwin] Server=[@(#)PROGRAM:smbd  PROJECT:smbx-105.4.0]

Sharename       Type      Comment
---------       ----      -------
Comp Staff's Public Folder Disk
CompRaid03      Disk
Dropbox         Disk
Groups          Disk
IPC$            IPC
Public          Disk
Users           Disk
compstaff       Disk

However, when I try and mount the CompRaid03 share, using this command:

sudo mount -t cifs // /mnt/myshare -o username=myuser

I get the same password prompt, but after putting the correct password in, I received this error:

mount error(22): Invalid argument

dmesg | tail returns:

[23576.037373] CIFS VFS: cifs_mount failed w/return code = -22

I don't understand what is wrong with this command. I've managed to mount a share on my current (Windows 8) machine using basically the same command but with a different IP address and share name (obviously). I've spent a good few hours trying to solve this and got no where. Any help or pointers would be greatly appreciated.

Thanks Steve


As suggested I've also trued using "user=" instead of "username=":

sudo mount -t cifs // /mnt/svnrepo -o user=myuser

This results in the same "Invalid argument" error.


I feel I should add to the question that in the end I couldn't figure out what the problem was, but, I used the exact same command to mount a share on a different shared drive that was running Debian and it worked fine - I can only assume it's therefore a flaw or idiosyncrasy of the SAMBA implementation that Darwin OS is using.


0 down vote

I have found a solution. Add the option sec=ntlm - this works both in a manual mount and from fstab

The fstab entry is now - Network USB Drive - ie the USB Flash Drive connected to the Modem

// /home/user/USB cifs sec=ntlm,uid=1000,gid=1000,guest,_netdev 0 0

Based with Thanks from http://ubuntuforums.org/showthread.php?t=2139090


On RHEL I had to edit file /etc/request-key.conf and add these 2 rows at the end of the file.

create       cifs.spnego    * * /usr/sbin/cifs.upcall -c %k
create       dns_resolver   * * /usr/sbin/cifs.upcall %k

One possible reason: system can't resolve server name.
I got below error when mounting shared folder.

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

enter image description here

Edit /etc/resolv.conf, add search "server", issue solved. enter image description here

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.