Tuesday, May 19, 2009

Controlling the firewall on Mac OS X 10.4 (Tiger) from the command line

I have just had the need to control (actually disable) the firewall on a Mac running OS X 10.4 (Tiger). This should be no problem; just start System Preferences go to Sharing... The problem was that the only connection I had to the machine was through SSH, so going to System Preferences was not an option.

Luckily the firewall can be controlled with the ipfw command on the command line. Take a look at this article at macdevcenter for an example of how to use ipfw.

And, to disable the firewall all that is needed is thus:
sudo ipfw disable firewall

Update: To disable the firewall on Mac OS X 10.5 (Leopard) you can issue the following command:
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0