3

I use pure-ftp for ftp server. I want an for pure-ftp to deny the upload of certain file types, for example .exe, .bat, .cs, etc.

Many thanks.

Castaglia
  • 3,239
  • 3
  • 19
  • 40
user86187
  • 33
  • 1
  • 4
  • Note that these type of blocking scripts generally do not examine the files themselves; they only look at the extension. Thus, they can be circumvented by renaming the source file. – Bacon Bits Jul 04 '11 at 05:10

1 Answers1

4

Pure-ftpd does not natively support blocking specific file types. However, you can accomplish this by running a script after the upload to delete the undesired file types.

You would use the pure-uploadscript program to accomplish this.

An example can be found here: http://www.webhostingtalk.com/showpost.php?p=6277573&postcount=4

(You will probably want to modify the banner to display what file types are not allowed.)

There is an inherent limitation this - a user could upload a file with an accepted extension and then rename it. You will probably want to scan the files (e.g. with clam-av) after they have been uploaded. You may also run a cron periodically to delete files with certain file extensions (e.g. uploaded by PHP, etc). I do believe that pure-ftpd has some options (-G -K) that disable deletion and/or renaming.

cyberx86
  • 20,620
  • 1
  • 60
  • 80