Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to restrict FTPS ports on both the server & client side of the connection?

I've already read this answer and I have vsftpd set to restrict passive port usage to a narrow range on the server side. I've verified that this restriction does work -- for the server. However, if the client is behind a firewall itself and is carefully restricting access on that end, the connections fail. Inspecting with tcpdump, it appears that arbitrary high ports on the client side are being used.

SFTP is not an option. (Believe me, I wish it were.)

share|improve this question
up vote 1 down vote accepted

In theory yes but I'm not aware of any FTP client software that will allow you to specify the source port and to be honest it'll probably cause more problems than solve if you started start messing with the source ports on a client device. It's really only the destination port that gets adjusted, I've never seen a firewall that locked down ports inside or out based on the source port, it's always the destination

Another reason not too play around with the source port is that it will more than likely get changed when it hits the source clients router/firewall. Most offices/home only have 1 external IP so in order to keep track of connections the internal IPs and source ports are changed by the firewall dynamically, which is commonly referred to as port address translation (PAT) as such even if you did specify the source port on the client there is no guarantee that it'll be the same when it hits the server.

share|improve this answer
This is business-to-business, not home clients, so I don't have to worry so much about casual users and NAT. (Yes, we looked into VPN, but that's a separate conversation.) – khedron Jun 7 '12 at 18:15

However, if the client is behind a firewall itself and is carefully restricting access on that end, the connections fail.

The client (or their IT dept) would have to allow those ports on their firewall. You can't really do much other than tell them what ports need to be open outbound.

Those high ports on the client are probably just the ephemeral ports on the host trying to make the connection, it's the outbound destination port (the ones you configured on your server side) that are most likely blocked on their firewall for outbound use.

share|improve this answer
Unfortunately, I see no way to restrict the high ports on the client. So it's not a matter of opening "those ports" on the client -- it would be opening all ports, which is clearly unacceptable. This is so far as I can tell from tcpdump & coworker reports on failures. I would be very happy to be incorrect about this! – khedron Jun 7 '12 at 17:01
the source port from the client ie shouldn't matter. It's where they are going that matters on their firewall rules. Most don't restrict source ports...typically. – TheCleaner Jun 7 '12 at 18:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.