Microsoft Vista SP2 has broken SAMBA through ssh tunnels

When trying my samba connections through ssh tunnels today, port 139 could not be forwarded by putty:

2009-08-12 17:13:53 Local port forwarding to lehre4:139 failed: Network error: Permission denied

I think, Vista has now also “stolen” port 139 on the loopback devices (see below for port 445). I try to grab it in my script also, before Vista can get it.

Note: I have said “I put it into autostart”. Actually, I use the “Task scheduler”, “Task Scheduler Library”, to run it at startup.

The script look now like:

# batch file to start the smb service without port 445 and 139
# Peter Steier 2009-02-28
start “bind_port_445” “C:\Program Files\nc.exe” -l -s -p 445
start “bind_port_139” “C:\Program Files\nc.exe” -l -s -p 139
net start smb
ping -n 2 -w 1000 > nul
taskkill /fi “Windowtitle eq bind_port_445”
taskkill /fi “Windowtitle eq bind_port_139”

However, still does not work… I just see that port 445 is now again the problem, not port 139. I undo this change.

I create HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\SmbDeviceEnabled = 0x00000000 (0)
Helps nothing. I delete the Key again.
However, maybe I have the solution. I check the recipe to prevent port grabbing at again, and see:

Go to “Device Manager” select View and enable “show hidden devices.”; Expand “Non-Plug and Play Drivers” and set “Message-oriented TCP/IP and TCP/IPv6 Protocol (SMB session)” to start on demand.

I check this – and see that it is set to “System” insted of “on demand”. I change this and reboot…
-> works! Problem solved.

7 Responses to “Microsoft Vista SP2 has broken SAMBA through ssh tunnels”

  1. Brad Says:

    Having an issue with your script. I am trying to do the same thing but I do not know how to bind ports. I am trying to be able to use windows shares over ssh as well as map a network drive over ssh.

    Can you send me your 2 binding scripts as well that you are calling in line 3 and line 4?

  2. petersteier Says:

    Actually, the line
    start “bind_port_445″ “C:\Program Files\nc.exe” -l -s -p 445
    does not call any scripts. nc.exe is a binary included in vista, and bind_port_XXX is just a window title.

    You just have to create a text file “grab_ports.bat” somewhere on your disk with the contents given in the original posting, and call it on startup using the task scheduler.

    I have only explored mapping drives, not shares. If you have problems with the mapping, I will write a guide collecting the info from all the various webpages I cite.

  3. Brad Says:

    Oh thanks for the post. I was able to get ssh shares and mapping working from a Vista Client > XP SP3 remote host shares and from XP client > XP remote host shares.

    But I can’t figure out why XP SP3 client WONT connect to Vista host remote shares.

    Any suggestions?

    Here is my setup

    Loopback adapter – (Net Bios disabled + Only TCP enabled)
    Using Putty I have forwarded to remoteip:139 and to remoteip:445. I know Vista does not use port 139 but rather port 445 for Smb sharing. I have tried different combinations of things including forwarding to remoteip:445 but nothing has worked.

    Hope that all makes sense. Is there something I need to change on Vista to allow it to connect?

  4. petersteier Says:

    Sorry, I have only explored Vista -> SAMBA through ssh. Did you try out the various registry changes I found in the web?

  5. Brad Says:

    Yeah. I have gotten Vista > XP but can’t get Vista > XP

    Do you have a Vista machine you could try from an XP machine? See if yours works.

  6. Brad Says:

    Those sites is actually how I found you. There was a guy on there that posted the same issue but their was no resolution to it on there. For that specific XP > Vista only XP > XP and Vista > Samba or XP

  7. petersteier Says:

    Sorry, I have no XP machine readily available – I’m just a Windows user, and do my programming (as a university assistant at a perticle accelerator) under linux. Thus, I appologize that I explore only the things which I actually need myself – already this cost me much more time than I should reasonably spend.

    However, I think sharing one’s knowledge with others is a duty – so I wish you success in your research and hope you will post your findings in some blog, so that I can find them if I need them some day.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: