How do you whitelist IPs for the service to allow only certain subnets on? Do I use IPTables or is there an easier way like IPWrappers Do you have to register the service for it to work with IPWrappers(hosts.allow)


If your vsftpd has been compiled with tcp_wrappers support then you can use it if you turn on the vsftpd configurstion option


If enabled, and vsftpd was compiled with tcp_wrappers support, incoming connections will be fed through tcp_wrappers access control. Furthermore, there is a mechanism for per-IP based configuration. If tcp_wrappers sets the VSFTPD_LOAD_CONF environment variable, then the vsftpd session will try and load the vsftpd configuration file specified in this variable.

You can then use the standard hosts.allow and hosts.deny files.

You can check to see if your vsftpd has been compiled with libwrap support like so

ldd /usr/sbin/vsftpd | grep wrap
libwrap.so.0 => /lib64/libwrap.so.0 (0x00002ae164bb6000)

The easiest way would be to use iptables:

iptables -A INPUT -s -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -s -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j DROP

to allow from and and dissallow from everyone else.

Don't forget to save iptables configuration (depends on your linux distro), so it will survive reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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