Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.5: Control the firewall from the command line System 10.5
It appears you can turn the Leopard firewall on or from the command line with this command:
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
The last value represents the state of the firewall, where:
  • 0 = off
  • 1 = on for specific services
  • 2 = on for essential services
There are other settings in the /Library/Preferences/com.apple.alf.plist file that you can explore and test to control other aspects of the firewall.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[8,533 views]  

10.5: Control the firewall from the command line | 3 comments | Create New Account
Click here to return to the '10.5: Control the firewall from the command line' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.5: Control the firewall from the command line
Authored by: kirkmc on Mon, Jan 14 2008 at 7:50AM PST
I'm sure you need to do something after running that command to get the firewall to read the plist file. Do you need to restart, or is there simply a daemon you have to quit and relaunch?

Kirk

---
Read my blog: Kirkville -- http://www.mcelhearn.com
Musings, Opinion and Miscellanea, on Macs, iPods and more

[ Reply to This | # ]
10.5: Control the firewall from the command line
Authored by: allanmarcus on Tue, Jan 15 2008 at 2:18PM PST
nope, just the command.

[ Reply to This | # ]
10.5: Control the firewall from the command line - GeekTool
Authored by: cxd101 on Tue, Jan 15 2008 at 5:18AM PST
MANY, MANY thanks for this post! Ever since I upgraded to Leopard, my firewall status "checker" using GeekTool has not worked, as I did not know what they new plist file was called. Using the information in this post, I was able to edit the GeekTool command, and it seems to work, as shown below:

if [ `defaults read "/Library/Preferences/com.apple.alf" globalstate` -eq 1 ];then EX=0;else EX=1;fi;exit $EX

[ Reply to This | # ]