I can easily block requests to a directory using a .htaccess file with "deny from all". However, I allow want to allow FTP access via clients and browsers alike. Is there a way I can restrict the denial to HTTP requests only?

  • are you using mod_ftp? – the-wabbit Feb 1 '12 at 7:50
  • @syneticon-dj: It doesn't show up under phpinfo(). However, mod_proxy_ftp is present, as is the --enable-ftp flag. – Luke Dennis Feb 1 '12 at 8:29
  • 1
    Could you elaborate a bit more on how you actually have set up FTP? Is your Apache serving FTP at all? mod_proxy_ftp is just doing FTP proxying, it is not an FTP server as such. The output of netstat -anp | egrep ":21.*LISTEN" should help identify the FTP server process – the-wabbit Feb 1 '12 at 8:45
  • Hm. I misdiagnosed the issue; it turns out FTP is not being served by Apache after all, so this question is irrelevant in this case. Thanks for pointing me in the right direction. – Luke Dennis Feb 1 '12 at 9:07

Adding as an answer based on comment exchange:

Apache has support for providing FTP services via the optionally loadable module mod_ftp, but most likely you have a dedicated FTP server process running alongside with your web services. The output of netstat -anp | egrep ":21.*LISTEN" which lists all listening sockets on port 21 (ftp) and the process name keeping the socket(s) open should help identify the FTP server process.

I believe mod_ftp uses the same access control mechanisms as the apache server and simply inherits what permissions you've defined for the virtual directory or within the .htaccess file. I can't find any reference that this behavior can be changed in the mod_ftp documentation.

If a different FTP server is used, it likely does not use .htaccess directives for access control. Refer to the respective software documentation on how to set access controls in this case.

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.