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?

thanks

link|improve this question
4  
Hi, I think this is more suitable on serverfault, you'd probably get a quicker response there – Steve Temple Nov 4 '09 at 0:40
feedback

migrated from stackoverflow.com Nov 4 '09 at 1:58

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

3 Answers

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.
link|improve this answer
feedback

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

link|improve this answer
feedback

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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown