Skip to main content

Sharing SMB/CIFS on the local network?

14 replies [Last post]
trana
Offline
Joined: 03/15/2010

Is there any way to connect to a Windows server via SSH and then present a remote share on the local network?

Thanks!

0
Justin
Justin's picture
Offline
Joined: 05/28/2008
You'll need an SSH server on

You'll need an SSH server on the Windows machine. I don't know much about that, but I'm sure it is available.

After that, you add an account for it in Meerkat, then a tunnel using that account. You would want to reach localhost port 139. Say you choose the local (Mac-side) port to be 10039.

Then, on the Mac side, you would connect to smb://localhost:10039 in Finder (Go > Connect to Server...).

There are some automation possibilities, as well as the potential to add a custom Bonjour service in order to make the share show up Mac-side in the Finder sidebar. Let me know if you'd be interested in more on that and I can elaborate.

trana
Offline
Joined: 03/15/2010
Yeah, I have everything

Yeah, I have everything working properly, but porting 139 through to 10139 isn't much use unless I can advertise it via Bonjour (and hopefully on a port where other machines will be able to use it). If I can do that, then all the local machines will be able to connect to the share without their own connections. I have an L2TP tunnel up right now but would prefer the SSH solution.

Can you elaborate on the Bonjour idea?

Justin
Justin's picture
Offline
Joined: 05/28/2008
Ok, once the tunnel is set

Ok, once the tunnel is set up, then you'll want to edit it & go to the advanced settings. Enable "Make tunnel endpoint available to other computers" (which should also solve your issue about other machines using it) and then the "Advertise over Bonjour as". Select "Custom..." as the type and enter a name such as SMB, Windows, or similar and a service type of "_smb._tcp.'

After saving the changes and activating the tunnel, you should see it show up in Finder's sidebar.

trana
Offline
Joined: 03/15/2010
I have it showing in the

I have it showing in the finder window, but when I click on it I don't see any shares or anything. I click on connect as and get a connection error message.

trana
Offline
Joined: 03/15/2010
Does anyone have an idea how

Does anyone have an idea how to make this work?

Thanks!

Justin
Justin's picture
Offline
Joined: 05/28/2008
I did some looking around and

I did some looking around and it seems that modern SMB servers can use port 445 instead of 139. I was not aware of this. Can you try editing the tunnel to use that remote port and see if it makes a difference?

trana
Offline
Joined: 03/15/2010
I changed it to 445 and

I changed it to 445 and 10445, also I opened up the CIFS port to my external and internal IPs.

I see the server in the finder but when I click on it nothing happens. I click on Connect As and get an error.

Justin
Justin's picture
Offline
Joined: 05/28/2008
Are you by any chance getting

Are you by any chance getting an error message about needing to access the shares locally from the Finder?

I have just tried testing this whole setup using VMware and file sharing over a Meerkat tunnel and am getting that error.

Researching a bit on it doesn't turn up much in the way of positive results:

http://discussions.info.apple.com/message.jspa?messageID=11212102

Justin
Justin's picture
Offline
Joined: 05/28/2008
From this, it sounds like you

From this, it sounds like you have to make essentially an ethernet alias so that you can access the IP 127.0.0.2 and have it point to localhost. Using an IP such as this will keep Finder from warning you about the "connecting to localhost" issue since it doesn't recognize the IP.

The command is this:

sudo ifconfig lo0 127.0.0.2 alias up

There's a bit more involved info here:

http://blog.lococobra.com/how-to-connect-to-samba-shares-over-the-internet-via-ssh-from-mac-os-x

I hope this helps. It sounds like Finder being "smart" is the real problem.

trana
Offline
Joined: 03/15/2010
No, I get Connection Failed.

No, I get Connection Failed. When I click on Connect As I get:

There was an error connecting to the server "files" check the server name or ip address and then try again.

If you are unable to resolve....

Justin
Justin's picture
Offline
Joined: 05/28/2008
Hmm, where is "files" coming

Hmm, where is "files" coming from? Are you using that as the hostname? Do you have a machine alias to that name? If the connection is failing, it should be failing to connect to localhost, as that is where the tunnel end point is. Your local machine should not really know anything about the remote machine as it is masked by the tunnel.

trana
Offline
Joined: 03/15/2010
"files" is the nickname of

"files" is the nickname of the tunnel. When you put that into Meerkat, that is the name that shows up in the finder on the lefthand side.

trana
Offline
Joined: 03/15/2010
So no one knows how to make

So no one knows how to make this work?

Justin
Justin's picture
Offline
Joined: 05/28/2008
I apologize for the lack of

I apologize for the lack of resolution to this, but it would appear that not many folks, if any, are trying this.

Just to confirm, you have the sharing working properly, it's really just coming down to configuring Bonjour properly so that Finder will work with it?

Another option might be to "bookmark" the connection in Finder's "Connect to Server" dialog. For example, you could type "smb://127.0.0.1:10137" (or whatever) into the dialog, then press the + button to save it for later use.

Want to join the forums? Create an account or login.