Tunneling Windows file shares: Various tips

Note: before trying the tips on this page, try the standard instructions on our main File share forwarding page. You may want to resort to the tricks listed here if the standard instructions fail to work in your case. Most of these tips were contributed by our users and were collected at various points in the past, applying to versions of Windows available at that time.

  • If your SSH client reports an error when attempting to bind port 139, this is because the port has already been bound by Windows. The conflict can be removed by configuring the SSH client to listen on a different interface (127.0.0.1 or 127.0.0.2). Otherwise, file and printer sharing on the sharing-consumer machine must be uninstalled. (Not just disabled for a specific adapter; completely removed.)
  • If, when attempting to connect to the shared drive, in your SSH client you don't see any forwarded channels created at all; or if you see forwarding channels being briefly created and immediately closed, and the connection to the shared drive doesn't get through; then file and printer sharing on the sharing-consumer machine must be uninstalled. (Not just disabled for a specific adapter; completely removed.)
  • You may also try disabling Windows listening for incoming file sharing connections on port 445, which override connections to the SSH client on port 139. You can disable port 445 through the Registry Editor (regedit). Locate the key: HKLM\System\CurrentControlSet\Services\NetBT\Parameters. You should see here a value called 'TransportBindName'. Double click this value, and then delete its default contents (assign it an empty string). After rebooting, you should find (through 'netstat -an') that Windows has stopped listening on port 445. This may allow connections to the SSH client on port 139 to succeed.
  • If all else fails, try this workaround recommended by one of our customers. Make sure that LMHOSTS is enabled on the sharing-consumer machine (see the WINS tab of advanced TCP/IP configuration). Then, add to your LMHOSTS file the following line: '127.0.0.1 sshshare'. The LMHOSTS file is located in the %SystemRoot%\System32\drivers\etc directory; if the file does not yet exist, create it. Do not use the '#PRE' or '#DOM' suffix on the line you are adding. Once you have enabled LMHOSTS and added the entry, reboot the machine, or just execute 'nbtstat -R'. You can now access the sharing-provider machine using a path that starts with '\\sshshare'.