Wednesday, April 28, 2010

Windows Vista/7 445 Port Auto-bind

Hello again all,

If you all haven't noticed, I retitled the blog to be Musings of a Systems Admin. I figure I have enough to write about systems administration (rather than just server related admin) that I needed a place to write without starting a new blog. That being said, welcome to Musings of a Systems Admin!

I have recently set up our primary internal firewall to accept connections only through port 22 to force all remote connections to be initialized through an encrypted ssh tunnel... a good idea to start at least.
At the beginning, everything worked nicely connecting from my remote Linux (Ubuntu) machine. I then proceeded to connect a Windows Vista and a Windows 7 machine with putty. Unfortunately no dice with both.

Here's the exact problem. I created the tunnel for port 445 (localhost:445 destination:445) and connected. SSH connected fine but trying to access the localhost fileshare resulted in a timeout/network device could not be found.

I searched the internet for several hours trying to find a solution to the problem (or even any info as to why it wasn't working when it should) and finally stumbled upon a Microsoft technet forum talking about my exact issue.

The cause of the problem is that in Windows Vista and Windows 7 (as well as Windows XP SP3), Microsoft has auto-bound ports 445 and 139, even when file sharing services are turned off. This is why you can't create an ssh tunnel; because the port is already in use.

The solution. After reading and trying each suggested solution to no avail, I finally stumbled upon a link to a program someone coded to remedy the situation. To my knowledge this works on every operating system (though I've only tested it on Vista and 7).

Enjoy the fix everyone and happy tunneling!