Dale Anderson's answer worked for me on Ubuntu 16.04 connecting to macOS 10.12.6 (Sierra).
I had been looking for a way to do this for quite some time, without success. I thought it was not possible, maybe because macOS had been updated to somehow exclude Linux, or that it would require manually hacking macOS (I have seen a few answers mentionning this).
It turns out that it was not straightforward but not impossible either, and Dale had the answer.
It would like to add that you do not need the Mac's IP address, and that you don't have to store your macOS username and password in a local text file, which I think is risky. You can use this command, which contains the Mac's machine name and the macOS username, and that will prompt you for the user's password:
sudo mount -t cifs //MacBook-CT.local/Projects mnt/projectsmac -o noauto,user,username=christopher,noperm,uid=ct,gid=ct,sec=ntlmssp,nounix
Please note that I use a mount directory located inside my own home directory, so mnt/projectsmac
is not a typo (I have a projectsmac
directory inside a mnt
directory under my home dir).
"christopher" is the macOS username, and "ct" is the Ubuntu username.
Also, the Mac's machine name is a potential source of problem. My Mac's name is actually "MacBook_CT", but I can't use it in the Linux command. To find out the name you must use over the network, open Sharing preferences on your Mac.
You can go even further and put the Mac user's password directly in the mount command:
sudo mount -t cifs //MacBook-CT.local/Projects mnt/projectsmac -o noauto,user,username=christopher,password="12345678",noperm,uid=ct,gid=ct,sec=ntlmssp,nounix
This may be practical if you want to embed this command in a script.