How to calculate FTP Pasv Port

So I found my self having issues with the new box for TheJunkFiles which is now running on OS X 10.6.8 Server. I found my self having FTP issues like randomly timing out on a LIST command my first thought (A Port Is Being Blocked) which was correct but OS x server tripped me up a bit in it has a built in firewall rule for PASV ports so I figured the FTP server would handle the range and keep in within those ports. That was where I was wrong seems it does not do that so I had to calculate what ports it was trying to use and expand the PASV rule’s port range. Here is how you calculate this info based on your PASV configuration in the FTP configuration or the PASV command passed in the FTP client.

227 Entering Passive Mode (10,10,1,11,22,12)

(22 x 256) + 12 = 5644

So the data port for this FTP connection will be port number 5644.

256 is a constant in the equation so you can just take the 2nd to last value and multiply it by 256 and add the ending vale to that to get the port. So that is how its done figured I would pass the info along for anyone else who was wondering how this is calculated.

Leave Comment

Your email address will not be published. Required fields are marked *