Restricting Access to File Sharing by IP addresses in Windows 11

How to Access Windows File Sharing

To access File sharing, you can do it through File Explorer. You can type the IP address in the address bar. You also type the name of the PC, not all LAN network topology can use the PC name.

For example, you can access it by typing the IP address as follows

\\192.168.1.1
folder sharing ip

RestrictIng File Sharing Access with Windows Firewall

If you have completed all the steps mentioned above, you have successfully shared a folder. The problem is that all PCs connected to the LAN network will access the folder.

In this step, we will restrict access using the Firewall and only allow certain IP addresses that can access it.

  1. Go to the “Control Panel” and select “System and Security > Windows Defender Firewall > Allowed apps“.
firewall app
  1. Then, in the “Allowed apps” window, click the “Change settings” button. You won’t be able to change the settings if you don’t click this button first.
  2. Uncheck “File and Printer Sharing” and “File and Printer Sharing over SMBDirect” to block all access.
firewall disable sharing
  1. Then open the “Control Panel” again and select “System and Security > Windows Defender Firewall > Advanced settings”.
  2. In the “Windows Defender Firewall with Advanced Security” window, select “Inbound Rule. Then right-click and select “New Rule“.
firewall new rule
  1. Next will open the window “New Inbound Rule Wizard“. In the “Rule Type“, select “Custom” and then click the “Next” button.
  2. Then on “Programs“, select “All programs“. Click the “Next” button.
  3. In the “Protocol and Ports” step, select the “TCP protocol. And at the local port, select “Specific Ports” with the port number “445“. Next click on the “Next” button.
firewall port setting
  1. Then in the “Scope” step, Remote IP section, add the IP of another PC that you allow to access file sharing on your PC.
firewall remote ip
  1. In the “Action” step, select “Allow the connection“. Then click the “Next” button.
  2. And in the “Profile” step, leave everything selected and click the “Next” button.
  3. The last step is to name the Rule you created. Give it a name that makes it easier for you to recognize it, such as “File Sharing – Allow specific IP”.
firewall allow specific ip

You can already restrict file sharing access with only certain IP addresses that can access it.

Latest Articles