MacOS – Connect to a Local SMB Share

macossmb

When attempting to connect to smb://localhost/share, I receive an error that I ought to access the files locally. This is not always desirable. For example, this means I can not use my portable home on my Mac Mini that is serving the home directory.

Windows (via native SMB/CIFS) and other *nix systems (via Samba) can access local shares just fine. Why can I not do so on OS X?

Best Answer

According this this link it is possible:

https://www.chrisnewland.com/solved-mac-osx-samba-cifs-through-ssh-tunnel-error-the-server-localhost-is-available-on-your-computer-364

Finder identifies smb://127.0.0.1 as a local filesystem and refuses
to mount port 445 even if you've set up an SSH tunnel using

-L 445:localhost:445 

The solution is to alias your lo0 interface to 127.0.0.2 and Finder doesn't see this as a local address.

sudo ifconfig lo0 127.0.0.2 alias up 

Create the ssh tunnel and map to your Samba / CIFS server

ssh user@remote -L 127.0.0.2:445:smbhost:445 

Now you can open the share in Finder

smb://user@127.0.0.2