SSH Port Forwarding and SAMBA

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
I am trying to set up a server to share SAMBA shares. I first tried using a VPN, FreeS/WAN failed miserably, and PoPToP worked until I disconnect (I get a kernel panic, and an Aiee about pptpctrl, and the system is unusable until I reboot, where the cycle continues). The program pptpctrl segmentation faults, and I don't know why. I would prefer to use a VPN, but it seems as if I am to use the SSH Port Forwarding. Now, I need windows XP based computers to access these shares. What Ports do I forward using mindterm, or putty (those are the two Windows SSH Clients I am familiare with). And, what address would I type in in the address bar, or in run to access these shares (after the SSH tunnel is open). Thanks in advance.
 

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
So I would type this:

\\localhost:139

? This is on a Windows XP Client, and a linux server on the internet.
 

Shogun

Member
Oct 13, 1999
91
0
0
Hey,

Once you have samba set up and your shares defined properly, you should be able to browse your network via My Network Places. If you are trying to connect to a share with Windows Explorer or via the Run command you would enter something like <machine_name>\\<share_name>.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: Shogun
Hey,

Once you have samba set up and your shares defined properly, you should be able to browse your network via My Network Places. If you are trying to connect to a share with Windows Explorer or via the Run command you would enter something like <machine_name>\\<share_name>.

Unless you are trying to go over an SSH tunnel.
 

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
Originally posted by: n0cmonkey
Originally posted by: Shogun Hey, Once you have samba set up and your shares defined properly, you should be able to browse your network via My Network Places. If you are trying to connect to a share with Windows Explorer or via the Run command you would enter something like <MACHINE_NAME>\\<SHARE_NAME>.
Unless you are trying to go over an SSH tunnel.

n0cmonkey, how would I access it over the ssh tunnel?
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: KraziKid
Originally posted by: n0cmonkey
Originally posted by: Shogun Hey, Once you have samba set up and your shares defined properly, you should be able to browse your network via My Network Places. If you are trying to connect to a share with Windows Explorer or via the Run command you would enter something like <MACHINE_NAME>\\<SHARE_NAME>.
Unless you are trying to go over an SSH tunnel.

n0cmonkey, how would I access it over the ssh tunnel?

If I had to for some reason I would setup the tunnel, connect to the localhost on the port specified in the tunnel, and be done with it.
 

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
Originally posted by: n0cmonkey
Originally posted by: KraziKid
Originally posted by: n0cmonkey
Originally posted by: Shogun Hey, Once you have samba set up and your shares defined properly, you should be able to browse your network via My Network Places. If you are trying to connect to a share with Windows Explorer or via the Run command you would enter something like <MACHINE_NAME>\\<SHARE_NAME>.
Unless you are trying to go over an SSH tunnel.
n0cmonkey, how would I access it over the ssh tunnel?
If I had to for some reason I would setup the tunnel, connect to the localhost on the port specified in the tunnel, and be done with it.

So if I forward port 139 on the remote server to port 2010 on the client, and the share name was 'Invoice', would I type this in the address bar?

\\localhost:2010\Invoice

?
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: KraziKid
Originally posted by: n0cmonkey
Originally posted by: KraziKid
Originally posted by: n0cmonkey
Originally posted by: Shogun Hey, Once you have samba set up and your shares defined properly, you should be able to browse your network via My Network Places. If you are trying to connect to a share with Windows Explorer or via the Run command you would enter something like <MACHINE_NAME>\\<SHARE_NAME>.
Unless you are trying to go over an SSH tunnel.
n0cmonkey, how would I access it over the ssh tunnel?
If I had to for some reason I would setup the tunnel, connect to the localhost on the port specified in the tunnel, and be done with it.

So if I forward port 139 on the remote server to port 2010 on the client, and the share name was 'Invoice', would I type this in the address bar?

\\localhost:2010\Invoice

?

I have not tested that, but it looks right to me.
 

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
All I would need is port 22 open if I use forwarding. I knew that, I was just not sure how to implement a SMB share using SSH Port Forwarding (I already use SSH Port Forwarding to view my mail, securely).
 

skyking

Lifer
Nov 21, 2001
22,630
5,739
146
Sorry if it seemed elementary, but there was no mention of port 22, and I wanted to be sure:)
 

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
Thanks anyway. I probably would have said the same thing, you always wanna try everything, even if it seems as if you would have tried it already.
 

manly

Lifer
Jan 25, 2000
12,874
3,647
136
Actually, your example probably wouldn't work if the Samba server's NetBIOS name is not "localhost". On second inspection, I'm pretty sure Windows clients do not allow specification of a port either. You *must* forward to local port 139. This effectively prevents you from exporting shares from the same system. You also have to hold "superuser" credentials to bind to port 139 with the SSH client.

You probably want to hard-code the appropriate NetBIOS name in the client's LMHOSTS file to resolve to 127.0.0.1.
 

PowerMacG5

Diamond Member
Apr 14, 2002
7,701
0
0
Originally posted by: manly
Actually, your example probably wouldn't work if the Samba server's NetBIOS name is not "localhost". On second inspection, I'm pretty sure Windows clients do not allow specification of a port either. You *must* forward to local port 139. This effectively prevents you from exporting shares from the same system. You also have to hold "superuser" credentials to bind to port 139 with the SSH client. You probably want to hard-code the appropriate NetBIOS name in the client's LMHOSTS file to resolve to 127.0.0.1.

Thats what the guide does. I forward remote port 139 to local port 139. Then I add
127.0.0.1 ServerName
to C:\WINDOWS\system32\drivers\etc\lmhosts, then reload the NBT cache by using nbtstat -R. It works fine, I don't even need to uninstall File and Printer sharing like the original person needed too. Once everything is setup, I just open a windows, and type
\\ServerName
Enter my password for the SAMBA shares, and everything works.