Map network drive to different port

Posted on 2005-04-04
Medium Priority
Last Modified: 2012-06-21

I'm running a samba server on one of my linux machines and I'd like to connect to it using the windows 'map network drive' interface. However, I've decided that I want to run this samba server on a port besides 139.  How can I tell windows to connect to this port instead, I've tried doing something like


and it doesnt processes the : to indicate an alterernate port as it would in a typical url

I've been told that this is 'impossible', suggestions for a clever work around would be more than welcome.

Question by:i_is_mike
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 13698244
I would imagine that port 139 is hard coded in to Windows and can't be changed, though someone might know a hack or work around.


Expert Comment

ID: 13698972
You could run a port redirector on the samba box that listens on 139 then forwards the requests to the correct port, but in essence you'd be running the samba box listening on 139 after doing that...it'd just be listening on your alternate port as well.  I can't see much reason for doing that unless a lot of other nix machines are already set up to use your alternate port and you can't warrant the time to change them back to 139.

Another thought would be to run a port redirector locally on the doze boxes...although that would break any sharing to other doze boxes.  If all shares were on the samba box then that should work...also bear in mind that port 445 is used for "simple file sharing", and I believe you'd need TCP and UDP packets forwarded in either case.

A simple command line redirector for windows is at http://www.kmint21.com/free/
A simple one for 'nix is at http://www.boutell.com/rinetd/ (actually there is a windows version as well)

Or, on the linux box you could do the redirecting via iptables like:
iptables -t nat -A PREROUTING -p tcp --dport 445 -i eth0 -j REDIRECT --to-port 4450
iptables -t nat -A PREROUTING -p udp --dport 445 -i eth0 -j REDIRECT --to-port 4450
iptables -t nat -A PREROUTING -p tcp --dport 139 -i eth0 -j REDIRECT --to-port 1390
iptables -t nat -A PREROUTING -p udp --dport 139 -i eth0 -j REDIRECT --to-port 1390

Expert Comment

ID: 13699074
Another idea would be to tunnel SMB through SSH (instructions at http://www.cs.duke.edu/csl/faqs/share_faq.php#[4])

You could set the tunnel on the doze boxes to go from local 139 to remote <whatever your samba is using>

SMB through SSH can be quirky sometimes tho.  Good luck!
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.


Author Comment

ID: 13699176
Thanks for the responses

The problem is essentially that my ISPs is now blocking 139 in for some ridiculous reason. (my machines are seperated by the internet)

Essentially I need to route to another port without disabling local file sharing. Otherwise it would just be a matter of turning off local file sharing then the port would be free and I could write my own forwarding utility in its place.

My best idea is to somehow create a new address locally. Bind a forwarding service to it on port 139 which routes everything to my linux box on a port of my choosing. Then just map network drive to that new address. But I wouldn't even know where to begin with that.

thoughts appreciated


Accepted Solution

fixnix earned 500 total points
ID: 13699676
In that case, 2 options:  

SMB tunneled through SSH as mentioned before, or set up a VPN and then the shares will work through the VPN tunnel.

Openvpn.org has simple open source client/server software for doze and 'nix, or of course you could use any other VPN solution you have access to.  I'm somewhat partial to SSH tunnels in general (running all my work www traffic through one right now to a web proxy on my home network) since they can be used for just about everything, but an OpenVPN setup may be the simplest to get your filesharing working accross the internet.

It is pretty common these days for residential ISP accounts to have 139 blocked...as well as 137, 445, and even 25 to smtp servers not on the ISP's network...thanks to mydoom, blaster, etc & spam zombie boxes.
LVL 25

Expert Comment

ID: 13700955
i agree with fixnix about either the ssh or VPN.  Setting up a VPN is standard practisc for allowing remote users to connect to a server or shared drive.  FYI there is a very good reason your ISP is blocking 139. Security.  You shouln't have this port open at all on your firewall either.  This is a huge secuirty risk.  Set up a VPN or SSH instead.

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question