Last Updated: February 25, 2016
·
1.02K
· pasine

Set Block all incoming connection via command line

I don't like to have any open port when I am connected to a public WiFi, so I usually turn on the Block all incoming settings from the Firewall preferences.

Here is a way to set/unset it via command line.

Set

sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 2

Unset

sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1

Bear in mind that the Preferences Panel must be closed to apply this change.

I also created a workflow to set/unset this option via Alfred.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

A network firewall allows or blocks connections. It cannot tell a legitimate payment script from one that was swapped to copy card data in the browser.

Security insights from Cside