How to Block Remote Connections to a Windows or Mac Computer
Keep out hackers and malicious tools
When you connect your PC to the internet, applications send and receive information through the network connection. Typically, you should have nothing to worry about this data exchange as it’s required for some apps and system functionalities to work correctly. On public or unsecured networks, however, you need to exercise extra caution.
One way to stay safe on public networks (e.g. Wi-Fi at hotels, airports, and restaurants) is toblock incoming connectionson your device. That’ll keep out hackers and other malicious tools on the network from gaining access to your computer.
Conversely, blocking outgoing connections can help prevent your apps from connecting to an unsafe internet network. It’s an effective way to stop a suspicious app/malware from downloading additional malware or communicating with its server.
Block Incoming Connection on Windows 10
You can restrict incoming connections by tweaking the Windows 10 Firewall settings. Here’s how to get it done.
-
Typecontrol panelin the Windows Search bar and selectControl Panelon the result.
-
SelectWindows Defender Firewall.
Note:If you don’t find the Windows Defender Firewall option on your PC’s Control Panel, set theView byoption at the top-right corner to either Large icons or Small icons and check again.
On the Windows Defender Firewall menu, you should see your connection profile:PrivateorPublic/Guest networks.
-
SelectChange notification settingson the left sidebar.
-
In the “Public network settings” section, check the box that reads “Block all incoming connections, including those in the list of allowed applications.” SelectOKto save the changes.
If you don’t fully trust the safety of your private network(s), you can also block incoming connections for such networks in the “Private network settings” section.
Pro Tip:To change the profile of Wi-Fi or Ethernet connection, go toSettings>Network & Internet>Wi-FiorEthernet. Select the network name and specify if it’s a private or public network in theNetwork profilesection.
Block Outgoing Connections on Windows 10
There are two ways to stop outgoing connections on Windows 10. Check them out below.
You can easily restrict outgoing connections for all apps by modifying the Windows Firewall advanced security settings. In the Windows Defender Firewall menu, selectAdvanced settingson the left sidebar.
Right-click “Windows Defender Firewall with Advanced Security on Local Computer” and selectProperties.
Go to thePublic Profiletab if you’re connected to a public network, or thePrivate Profiletab if you want to block outgoing connections for a private network. Forcomputers joined to a domain, theDomain Profiletab is the place to block outgoing connections.
Click the Outbound connections drop-down option and selectBlock. SelectApplyand thenOKto save the changes.
Say you want to block outgoing connections for your web browser only, Windows lets you do that efficiently. This can also serve as aparental control toolto prevent your kids from accessing the internet.
In the Firewall Advanced Security menu, select and right-clickOutbound Rules. SelectNew Ruleon the context menu to proceed.
SelectProgramand selectNext.
SelectBrowseto choose the application.
Go toLocal Disk (C:)>Program Files (x86)to find applications installed on your PC. Use the search box to locate an app that isn’t in the Program Files folder. Select the application’s executable file (.exe) and selectOpen.
SelectNextto proceed. Afterward, selectBlock the connectionand clickNext.
Specify the network profile(s) for which you want Windows to block the app’s outgoing connection. SelectNextto proceed.
Give the outbound rule a name or a description and selectFinish.
To unblock outgoing connections for the app, double-click on the outbound rule in the Firewall Advanced Security menu. SelectAllow the connection, then selectApplyandOK.
Alternatively, you could right-click on the rule and selectDeleteorDisable Rule. These options will also grant the app access to initiate outgoing connections.
Block Incoming Connections on Mac
Restricting incoming connections on Mac is also straightforward. Read the steps below.
-
Go toSystem Preferences>Security & Privacy.
-
In theFirewalltab, select the lock icon at the bottom-left corner.
Enter your Mac’s password or use Touch ID to access the security preferences menu.
-
SelectFirewall Optionsto proceed.
-
To block system-wide (incoming) connections for all apps and services, check theBlock all incoming connectionsbox and selectOK.
Your Mac will remain visible to other devices and networks when you block all incoming connections. However, no device or individual can establish a connection with your Mac.
Note that this will also render file-sharing services (e.g. AirDrop) and remote access tools (e.g. Screen Sharing) temporarily unavailable.
-
To block incoming connections for built-in software only, uncheck theAutomatically allow built-in software to receive incoming connections.
-
If you wish to block incoming connections for a specific app or service, click theplus (+) icon.
-
Select the app(s) and selectAdd.
Pro Tip:To select multiple apps, holdCommandand click the apps.
- Click the up and down arrows next to the app(s) and selectBlock incoming connections.
Block Outgoing Connections on Mac
macOS lacks a native tool or built-in method to block outgoing connections. There’s a workaround that involves blocking a website’s IP address or domain name, but it isn’t straightforward. Likewise, the method can only be used to block outgoing connections to websites, not applications. Follow the steps below to try it out.
-
Launch a Finder window, go toApplications>Utilitiesand open theTerminalapp.
-
Paste the command below in the Terminal console and pressReturn.
sudo cp /private/etc/hosts ~/Documents/hosts-backup
This command will create a backup of your Mac’s Hosts file in the Documents folder (Finder>Documents). The Hosts file is an important system file used by macOS to match domain names with their respective IP addresses.
-
Enter your Mac’s password and pressReturn.
-
Paste this next command in Terminal and pressReturn.
sudo nano /private/etc/hosts
This grants you administrative permission to modify the Hosts file. Enter your Mac’s password and pressReturnto proceed.
-
Type127.0.0.1, press theTabbutton on your keyboard, and enter theURL of the websiteyou want to block. If you want to block YouTube, for example, type127.0.0.1, pressTab, and typewww.youtube.com.
-
PressControl + Oand pressReturnon your keyboard.
-
Afterward, pressControl + X.
-
Finally, type or pastedscacheutil -flushcacheand pressReturn.
Launch your browser and visit the website you blocked. Your browser should display an error message saying it cannot connect to the website’s server.
Unblock Outgoing Connections on Mac
You can’t unblock an app’s outgoing connection by entering some Terminal codes or commands. You’ll need to restore the backup Hosts file you created while blocking the app’s connection. Follow the steps below to get it done.
-
Go toFinder>Documents, double-click thehosts-backupfile, and copy its content.
-
On your Mac’s desktop, selectGoon the menu bar and selectGo to Folder.
-
Paste the path below in the dialog box and selectGo.
/private/etc/hosts
-
Drag thehostsfile to the desktop.
-
Double-click the file on the desktop, delete its content, and replace it with the content of thehosts-backupfile (in Step 1 above).
Close the TextEditor window and drag the host file back to the/private/etc/folder.
- SelectReplaceon the prompt that comes up on the screen. You may also need to enter your Mac’s password or authenticate via Touch ID.
Visit the website on your browser and verify that it’s no longer blocked.
Use Third-Party Apps
Managing outgoing connections on macOS is quite exhausting. Interestingly, there are third-party apps likeLittle SnitchandRadio Silencethat simplify the task. These apps aren’t free, but they offer generous trial modes that let you use them without payment for a specific period. Little Snitch (from $ 48.99) has a demo mode with a 3-hour limitation per session while Radio Silence ($9) offers a 30-day free trial.
We tested both apps and they blocked outgoing connections perfectly. Radio Silence is the cost-effective option but Little Snitch is feature-packed and sports advanced features like silent mode, alert mode, network map, and more.
Sodiq has written thousands of tutorials, guides, and explainers over the past 4 years to help people solve problems with Android, iOS, Mac, and Windows devices. He also enjoys reviewing consumer tech products (smartphones, smart home devices, accessories, etc.) and binge-watching comedy series in his spare time.Read Sodiq’s Full Bio
Leave a Reply
Your email address will not be published.Required fields are marked*
Comment*
Name*
Email*
Website
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved