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

I only want to be able to connect to my unix box via ftp from a small range of ips. other services (i.e., www , mail , ssh) should be from any ip as usual

how can i set this up?


share|improve this question

migrated from Nov 4 '09 at 1:58

This question came from our site for professional and enthusiast programmers.

3 Answers 3

You didn't say which type of unix, which ftp server or provide us with enough details to give you specific directions.

There are many ways general ways to do this.

  • Adjust your ftp server configuration to not respond to some any reuqests execpt for the range you want to allow. I am pretty sure many of the more advanced ftp servers allow this.
  • Adjust the host-firewall rules on your ftp server to block inconing ftp connections except for the ranges you want to allow.
  • Update the firewall for your network
  • Use tcp-wrappers if available on your system. Basically you just have to unblock/block things in your hosts.allow and hosts.deny.
share|improve this answer

If you are using a typical ftpd launched from inetd, look into the tcp-wrappers package.

share|improve this answer

What "unix" is that?

On Linux, for this sort of thing, I always use iptables - the built-in firewall.

iptables -A INPUT -s X.Y.Z.K/32 --dport 21 -j ACCEPT
iptables -A INPUT --dport 21 -j DROP
share|improve this answer

Your Answer


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