Sunday, March 20, 2011

How to disable CIFS/SMB port 445 on Windows 7 64 bit

So, I had a requirement of disabling the port 445 on a Win 7 64 bit machine. The first thing which we do is to 'google' to find out a solution and I did the same. I found some results and they looked convincing. I tried the first method which was something like:
  • Open registry editor
  • Go to 'HKLM\System\CurrentControlSet\ Services\NetBT\Parameters' key
  • Go to option called TransportBindName (on the right hand side)
  • Empty the value so that Data (value) of 'TransportBindName' is empty. Close Registry Editor.
  • Reboot the PC
  • And you are done
Aah, it was so simple I thought and followed the procedure. To my irritation, this didn't work. no problem, there was another method on some other website:
  • As again, this requires opening the registry editor
  • Go to 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters' key
  • Create a 'REG_DWORD' Entry with the name SMBDeviceEnabled and give it's value 0
  • Close Registry Editor
  • Reboot the PC
Waah, it also seemed simple. I followed the procedures and waited till the PC rebooted. And again to my greater irritation, it didn't work.

I went on googling and almost experimented all the things I found - none of them worked for me. It took almost one full day :(

Then I started experimenting on my own, and luckily to my great satisfaction, I found it. Here is what worked for me:

  • Open Services by typing services.msc in Run dialog box.
  • Locate the service named 'Server'. The description field for this should be saying something like 'Supports file, print, and named-pipe sharing over the network for this computer. If this service is stopped, these functions will be unavailable. If this service is disabled, any services that explicitly depend on it will fail to start. '
  • Double click on that service
  • Click on the button 'Stop' to stop it.
  • In the Startup Type combo choose 'Disabled' so that on the next boot, this service will not start running. Apply your changes by clicking on Ok.
  • Now locate another service named 'TCP/IP NetBIOS Helper'. The description should read something like 'Enables support for NetBIOS over TCP/IP (NetBT) service and NetBIOS name resolution.'.
  • Do the same with this service - stop it and disable it.
  • Restart the computer
There can be slight variation in names/description as while writing this blog post, I was on a XP machine.

Disclaimer: By reading the descriptions of the services you disabled, you should have a hint that your file sharing and other things will not work on the next reboot.

You can always go to Services again and set the services as 'Automatic' to enable them on the next reboot.

if it also works for you, kindly come back and leave a note of appreciation.

15 comments:

  1. Worked for me. The trick is to disable and reboot. You can't just stop the Server Service and TCP/IP Helper, the 445 port will still be listening. Thanks!

    ReplyDelete
  2. Hello dear - Restart the computer (the last step listed above) essentially means reboot it - isn't it :)

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Works like a charm. Thanks a lot!

    The Anonymous reply has a point though. If you have to reboot anyway, the step of manually stopping the service is actually unnecessary (redundant).

    Maybe the guide can be made simpler and less confusing by eliminating that step.

    ReplyDelete
  5. Actually, disabling NetBIOs on the LAN Adapter is enough to free port 445, no need to disable any services:

    Lan Adapter > Properties > IPv4 Properties > Advanced > WINS > Disable NetBIOS

    Reboot et - voila!

    ReplyDelete
    Replies
    1. Yeah, but this will shutdown sharing in LAN... or on LAN adapter you disabled NetBios..

      Delete
  6. 135, 139, 445, 5355

    close 445 great.. i can touch that..

    listening in the sky..

    ReplyDelete
  7. i question..

    u can see listening line in windows, linux, firewall, and route ?? xD

    anonymous is free IN anything

    ReplyDelete
  8. Doesn't work for me in Win7 or Win8. So this fix no longer functions. :(

    Trying to find another solution to use an alternate port instead of the hassle of creating a fake Ip to bind to.

    ReplyDelete
  9. Hello,

    Just to confirm, I have tried this on Windows 8 by disabling both services "Server" and "TCP/IP NetBIOS Helper". After rebooting, and running "netstat -ano" in the Command Prompt, port 445 was no long listening. So, there is no need to mess with the Registry. Thank you!

    Regards,

    Jared Burrows

    ReplyDelete
  10. seconfig xp work in x86 w7, does it work in x64?

    ReplyDelete
  11. work with either windows powershell or use registry edit it works!!!!!!!!

    ReplyDelete
  12. I followed step by step. Hope it actually works.

    ReplyDelete
  13. Sorry,
    I have the value : "/device/" (clic right on TransportBindName), so I have to delete "/device" and "TransportBindName" becomes empty?
    Thank you
    Best regards

    ReplyDelete