How to scan FTP uploaded files on cPanel Servers

First make sure to install clamAV,We ave already discuss in our previous articles how to install and run clamAV on server. Clam ANTIVIRUS is a free and open-source, cross-platform antivirus software tool-kit which has now been included in Cpanel/WHM. It detect many types of malicious software, including viruses. One of its basic use is on mail servers as a server-side email virus scanner.

You can also install it from your WHM interface as root by clicking on:

cPanel —> Manage Plugins —> on clamavconnector

Check the “Install and Keep Updated” and then click at the bottom of the page to save.

Now we need to edit the file /etc/pure-ftpd.conf and change this line with:

CallUploadScript yes

Next create file /etc/pure-ftpd/ with this content:


#Maximum file size to scan in bytes that’s set to 10MB


if [ “$UPLOAD_SIZE” -le “$MAXSIZE” ]; then

/usr/bin/clamdscan –remove –quiet –no-summary “$1”


Change its permissions to make it executable:

chmod 755 /etc/pure-ftpd/

Now we should start the pure-uploadscript daemon every time to call our script when a file is uploaded

/usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/

And to let it start with your server/vps boots just run this :

echo “/usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/” >> /etc/rc.d/rc.local

Now restart pure-ftpd :

service pure-ftpd restart

Now all your uploaded files which are less than 10MB in size will be scanned by ClamAV, You can adjust the size limit as per your requirements.

That’all to do.Please Give your opinion below if you experience any issues or to discuss your ideas and experiences.