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.