How to Restrict File Sharing to a Private Profile Only on Windows 11
🔍 WiseChecker

How to Restrict File Sharing to a Private Profile Only on Windows 11

Windows 11 lets you share files and printers with other devices on your network. By default, network discovery and file sharing can be enabled on both private and public networks. This creates a security risk because public networks, such as those in coffee shops or airports, expose your shared folders to anyone connected. The solution is to restrict file sharing so it only works when your network profile is set to Private.

This article explains how to configure Windows 11 to enable file sharing exclusively on private networks. You will learn the exact steps to change network profile types, turn off sharing on public networks, and verify the settings are applied correctly. These changes apply to Windows 11 version 22H2 and later.

Key Takeaways: Restrict File Sharing to Private Networks

  • Settings > Network & internet > Ethernet or Wi-Fi > Network profile type: Switch the network profile to Public to block file sharing automatically.
  • Settings > Network & internet > Advanced network settings > Advanced sharing settings: Turn off network discovery and file sharing for the Public profile while keeping them on for the Private profile.
  • Control Panel > Network and Sharing Center > Change advanced sharing settings: An alternative path to configure per-profile sharing rules.

ADVERTISEMENT

How Windows 11 Uses Network Profiles for File Sharing

Windows 11 assigns a network profile type to every network you connect to: Private or Public. The Private profile is intended for trusted networks like your home or office. The Public profile is for untrusted networks like hotel Wi-Fi or public hotspots. The operating system applies different firewall rules and sharing behaviors based on this profile.

When file sharing is enabled globally, it applies to both profiles unless you configure it otherwise. By restricting file sharing to the Private profile only, you ensure that no device on a public network can see or access your shared folders, printers, or media. This is a fundamental security practice for any Windows 11 device that moves between different network environments.

Prerequisites

Before you begin, confirm that your Windows 11 build is 22H2 or newer. To check, open Settings > System > About and look at the Windows specifications section. You also need administrator privileges to change network profile settings and sharing configurations. If your device is managed by an organization, group policies may override these settings.

Steps to Restrict File Sharing to the Private Profile

You will perform two main tasks. First, set your current network profile to Private if it is not already. Second, disable network discovery and file sharing for the Public profile while leaving them enabled for the Private profile. Follow the steps in order.

Set the Network Profile to Private

  1. Open Settings
    Press Win + I to open Settings. Click Network & internet in the left sidebar.
  2. Select your active connection
    If you are using Wi-Fi, click Wi-Fi. If you are using Ethernet, click Ethernet. The active connection is shown at the top.
  3. Change the network profile type
    On the connection properties page, locate the Network profile type section. Select Private. This tells Windows 11 to treat the network as trusted and allows file sharing if enabled.

Configure Advanced Sharing Settings Per Profile

  1. Open Advanced sharing settings
    In Settings, go to Network & internet > Advanced network settings. Under the More settings section, click Advanced sharing settings.
  2. Expand the Private profile section
    Click the arrow next to Private to expand the settings. Turn on Network discovery and File and printer sharing if they are off. This ensures sharing works on your private network.
  3. Expand the Public profile section
    Click the arrow next to Public. Turn off Network discovery and File and printer sharing. This prevents any sharing activity when you connect to a public network.
  4. Save changes
    Click Save at the bottom of the page. You may need to confirm with administrator credentials.

Verify the Configuration

  1. Check your active network profile
    Open Settings > Network & internet > Wi-Fi or Ethernet. Confirm the profile type is Private.
  2. Test file sharing
    On another device connected to the same private network, open File Explorer and click Network in the left pane. You should see your Windows 11 computer listed. If you do not see it, ensure network discovery is enabled on both devices.
  3. Simulate a public network
    Switch your network profile to Public temporarily by selecting Public in the connection properties. Open File Explorer > Network. Your computer should not appear. Switch back to Private after testing.

ADVERTISEMENT

Common Mistakes and Limitations

File Sharing Still Active on Public Networks After Configuration

If file sharing remains active on a public network, the most likely cause is that the Public profile settings were not saved correctly. Go back to Advanced sharing settings and verify that both Network discovery and File and printer sharing are turned off under the Public profile. Also check that no third-party firewall software is overriding Windows Firewall rules.

Network Profile Changes Automatically

Windows 11 may automatically change a network profile from Private to Public after a driver update or network reset. To prevent this, you can set a static profile by using PowerShell. Open PowerShell as administrator and run:
Set-NetConnectionProfile -InterfaceAlias "Wi-Fi" -NetworkCategory Private
Replace “Wi-Fi” with the name of your connection. This locks the profile to Private until you change it manually.

Group Policies Override Settings

On domain-joined computers, group policies from your organization may enforce sharing rules that ignore the per-profile settings. If you cannot change the sharing state, contact your IT administrator. The relevant policy is located at Computer Configuration > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile.

Private Profile vs Public Profile: File Sharing Behavior

Item Private Profile Public Profile
Network discovery Enabled by default when sharing is turned on Disabled by default
File and printer sharing Enabled when you turn it on in advanced sharing Disabled when you turn it off in advanced sharing
Windows Firewall rules Allows inbound sharing traffic Blocks inbound sharing traffic
Recommended use case Home or office trusted networks Public Wi-Fi, hotels, airports
User control You can manually enable or disable sharing You can manually enable but should not

This table summarizes how each profile handles sharing. The key difference is that the Public profile blocks inbound sharing by default, and you must explicitly disable sharing there to ensure no accidental exposure.

Conclusion

You can now restrict file sharing to a Private profile only on Windows 11 by setting the network profile type and configuring advanced sharing settings separately for Private and Public networks. This approach keeps your shared folders and printers invisible on untrusted networks while allowing full access on your home or office network. As a next step, test the configuration by temporarily switching to a Public profile and verifying that your computer disappears from the network list. For advanced protection, consider using Windows Firewall with Advanced Security to create custom inbound rules that block file sharing ports (TCP 445, 139) on all Public network connections.

ADVERTISEMENT