Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 2.29 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[21,692 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 whoever posted them. This site is not responsible for what they say.
10.5: Control the firewall from the command line
Authored by: kirkmc on Jan 14, '08 07:50:10AM

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 Jan 15, '08 02:18:06PM

nope, just the command.



[ Reply to This | # ]
10.5: Control the firewall from the command line - GeekTool
Authored by: cxd101 on Jan 15, '08 05:18:09AM

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 | # ]