How do I access a samba server in a LAN from outside?

Hi,
To make it simple.
A SAMBA server (LAN IP 192.168.1.254) is in very simple office LAN. For safety reason, the router facing internet is not configured to do port forwarding to the SAMBA server, instead, visits on router's port 9991 are forwarded to an SSH server in the LAN. I tried the following command on a Windows host from outside the LAN in a hope to establish a SSH tunnel to the SAMBA server, then do the "map network drive..." on the Win host and input \\127.0.0.1:13579 to map to the samba server.
ssh myuser@url -p 9991 -L 13579:192.168.1.254:445 -N
ssh myuser@url -p 9991 -L 13579:192.168.1.254:445 -L 24680:192.168.1.254:139 -N

No surprise they failed.
In my case, how do I access the SAMBA server in question?

PS, following command works when I wanna do remote desktop to an internal workstation(LAN IP 192.168.1.96).
ssh myuser@url -p 9991 -L 12345:192.168.1.96:3389 -N
 
input \\127.0.0.1:13579
This uses WebDAV, not SMB/CIFS. For SMB/CIFS it has to be 445. And you likely can't use localhost:445 because it's probably already in use by Windows itself.

I'd suggest just setting up a simple VPN to tunnel the SMB traffic. Much easier to do.
 
Can this line of command on Windows host do the job?

ssh -v -J dzs97p@url:9991 -L 4445:192.168.1.254:445 dzs97p@192.168.1.161(ssh_server)

In the many lines of the output, "Local forwarding listening on 127.0.0.1 port 4445" is there, but the "map network drive" still fails.
 
Can this line of command on Windows host do the job?

ssh -v -J dzs97p@url:9991 -L 4445:192.168.1.254:445 dzs97p@192.168.1.161(ssh_server)

In the many lines of the output, "Local forwarding listening on 127.0.0.1 port 4445" is there, but the "map network drive" still fails.
I'm assuming you mean to use the SSH implementation of Windows itself (C:\Windows\system32\openssh\)?

Keep in mind that Windows' own implementation of SSH is seriously lacking. I say this because... even with a full blown graphics manager behind it Windows still doesn't accept graphics forwarding ("X11") because.. OpenSSH is nothing but an 'easy' add-on to Microsoft. No more, no less.

Only meant to be used on the commandline.
 
If you can SSH into a (UNIX/Linux) host on the LAN I'd suggest mounting those Samba shares in that host. I've done that a lot in an office I used to work at.
 
Like many here recomends you, make a VPN
open SMB ports to the outside is shooting yourself in the foot
I never know if the defaults ports in windows can be changed :-/
 
Back
Top