Tuesday, June 30, 2009

Windows Firewall and non-secure FTP traffic

I was recently trying to setup an FTP server on server 2008 and could not get it to work properly. Turns out, even though the firewall had allowed the ftp service I needed to open port 21. I accomplished this by running the two simple commands.

Windows firewall can be configured from command line using netsh command.

1) Open port 21 on the firewall

netsh advfirewall firewall add rule name="FTP (no SSL)" action=allow protocol=TCP dir=in localport=21

2) Activate firewall application filter for FTP (aka Stateful FTP) that will dynamically open ports for data connections

netsh advfirewall set global StatefulFtp enable