Note: All of this presumes you know how to create a Mac share and that you have cifs-utils installed on Linux.
The following syntax worked perfectly, for me, in 2020 – the Mac OS was Mavericks and the Linux OS was Zorin 15 (Ubuntu “Bionic” 18.04):
mount -t cifs //ServerName/ShareName /mnt/YourMountPointName -o username=ServerUsername,password=YourPassword,nounix,sec=ntlmssp,vers=1.0
If the above is difficult to read…again:
mount -t cifs //ServerName/ShareName /mnt/YourMountPointName -o username=ServerUsername,password=YourPassword,nounix,sec=ntlmssp,vers=1.0
Update 2023
Everything on this page – including paragraphs following this update – refer to a method which used to work. When, precisely, this new syntax became a standard is something I don’t know – I know that as of High Sierra (a least) the above does not work and the following works as long as the remote samba server has user level shares enabled, and, a user with the same username as the local Mac with sharing privileges granted to that user for the specific share (in smb.conf on Linux):
mount_smbfs //mac_username:remote_password@the_remote_domain.com/share_name /Users/guymerritt/Desktop/some_directory_on_mac
RANDOM NOTE – MOUNT AS MAC USER: Okay, I think this should be obvious but I just wasted 30-minutes surfing the web looking for an answer to a problem. I had created a folder on my desktop (Mojave, if it matters) as a mount point and was opening a terminal, switching to the root account (which I enable), and was having all sorts of weirdness mounting a remote, Linux share. I would mount the share and the desktop folder would disappear. I looked at the folders permissions, when it was mounted (it was still visible from a terminal), and they were “root:wheel”. Doh. This needs to be done, in a terminal, from the user account.
(Older notes, archived)
Syntax Must Include Version Number
I found this syntax on the web, minus the “vers=1.0” at the end. And, without this at the end, the attempt to mount a Mac share failed with an error code (which I don’t recall, at the moment). I believe the error was “operation not supported”. Oddly, on the page where I found the syntax numerous people thanked the writer and said that it worked perfectly – apparently, without the version number tacked on the end. All I can say is that, in my experience, this had to be added for the share to be mounted successfully. The version number might have to be adjusted (eg. “vers=2.0”, etc.) – it’s unclear to me. All I know is that adding “vers=1.0”, from Zorin 15, worked for me.
This is from the web, regarding smb version numbers, and applys to Windows – just here for my own future reference (should I need this info):
I didn’t find a list of the allowed levels for smbclient. According to Marc Muehlfeld in this thread the versions used by Windows are:
- SMB 2.0 was introduced by Vista/2008
- SMB 2.1 by Win7/2008R2
- SMB 2.2 aka 3.0 by Win8/2012
- SMB 3.02 by 8.1/2012R2
There are several different
mount
error messages which can be traced back to mismatched protocol level.
Sub-folders
I don’t know if it was required but I gave read/write permissions to some sub-folders in the Mac share, and, I also used a terminal to recursively chmod the sub-folders to 777. Linux was able to write to the sub-foldsers without a problem.