SMB/CIFS Sharing from OS X to Linux

Published 2013-03-26, by John

I ran into issues recently trying to share files from OS X (Mountain Lion, 10.8.3) to Linux (Ubuntu Server 12.10) using SMB/CIFS. I couldn’t get the basic mount commands or /etc/fstab settings to work on Linux; these continually returned a cryptic error message “Invalid argument” and associated error code of -22. Trying different combinations of mount options from the few relevant up-front Google results I could find didn’t fix the issue.

After lots of frustration and near hopelessness, I took a break before giving it one more go. I finally found the magic incantation necessary [citation needed] to access my files on OS X from Linux via CIFS, allowing me to mount the OS X folders just like any other shared drive, directory, or folder. Hopefully this will help others running into the same or similar issues.

Add the following to the Linux-side mount options for the OS X CIFS shares: nounix,sec=ntlmssp

For example, to mount from the Linux command line:

mount -t cifs //mac-osx-server/shared-folder /linux/mount/point -o user=...,pass=...,nounix,sec=ntlmssp

Or in your Linux /etc/fstab:

//mac-osx-server/shared-folder /linux/mount/point cifs user=...,pass=...,nounix,sec=ntlmssp 0 0

“nounix” tells Linux not to assume or request CIFS Unix Extensions from the OS X file server.

“sec=ntlmssp” tells Linux to use a particular variant of the NTLM security scheme when negotiating the permissions and mountability of the shared folder from the OS X file server.

Relatedly, I also found that I couldn’t use the “guest” mount option on Linux; instead I had to use “user=guest,pass=”  with the password field specified but no value associated with it.

Happy mounting! 🙂