{"id":269,"date":"2025-04-11T13:18:11","date_gmt":"2025-04-11T11:18:11","guid":{"rendered":"https:\/\/www.24x7serverguard.com\/blog\/?p=269"},"modified":"2025-04-11T13:18:11","modified_gmt":"2025-04-11T11:18:11","slug":"%f0%9f%9b%a1%ef%b8%8f-how-to-scan-ftp-uploads-with-clamav-on-cpanel-whm","status":"publish","type":"post","link":"https:\/\/www.24x7serverguard.com\/blog\/cpanel\/%f0%9f%9b%a1%ef%b8%8f-how-to-scan-ftp-uploads-with-clamav-on-cpanel-whm\/","title":{"rendered":"\ud83d\udee1\ufe0f How to Scan FTP Uploads with ClamAV on cPanel\/WHM?"},"content":{"rendered":"\n<p>This guide will help you automatically scan all FTP-uploaded files for viruses using <strong>ClamAV<\/strong> and <strong>Pure-FTPd<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd27 Step 1: Install ClamAV via WHM<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to <strong>WHM<\/strong> as root.<\/li>\n\n\n\n<li>Navigate to:<br><code>cPanel \u2192 Manage Plugins<\/code><\/li>\n\n\n\n<li>Locate <strong>clamavconnector<\/strong>.<\/li>\n\n\n\n<li>Check the box <strong>\u201cInstall and Keep Updated\u201d<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Save<\/strong> at the bottom.<\/li>\n\n\n\n<li>Wait for the installation to complete.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udee0\ufe0f Step 2: Enable Upload Script Trigger in Pure-FTPd<\/h3>\n\n\n\n<p>Edit <code>\/etc\/pure-ftpd.conf<\/code>:<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">nano \/etc\/pure-ftpd.conf<\/mark><\/p>\n\n\n\n<p>Find the line:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">CallUploadScript no<br><\/mark><br>And change it to:<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">CallUploadScript yes<\/mark><br>Save and exit the file.<br><br><br>\ud83e\uddea Step 3: Create the ClamAV Upload Scan Script<br>Create the file \/etc\/pure-ftpd\/clamav_check.sh:<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">nano \/etc\/pure-ftpd\/clamav_check.sh<br><\/mark>Paste the following content:<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">#!\/bin\/bash<br># Max file size to scan (10MB in bytes)<br>MAXSIZE=10485760<br><br>if [ \"$UPLOAD_SIZE\" -le \"$MAXSIZE\" ]; then<br>    \/usr\/bin\/clamdscan --remove --quiet --no-summary \"$1\"<br>fi<br><\/mark><br>Make it executable:<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">chmod 755 \/etc\/pure-ftpd\/clamav_check.sh<br><\/mark><br><br>\ud83e\udde9 Step 4: Enable the Upload Script Daemon<br>Run this command to start the upload script daemon:<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\/usr\/sbin\/pure-uploadscript -B -r \/etc\/pure-ftpd\/clamav_check.sh<br><br><\/mark><br>To ensure it starts on boot, add it to rc.local:<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">echo \"\/usr\/sbin\/pure-uploadscript -B -r \/etc\/pure-ftpd\/clamav_check.sh\" >> \/etc\/rc.d\/rc.local<\/mark><br><br>Make sure rc.local is executable:<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">chmod +x \/etc\/rc.d\/rc.local<br><\/mark><br>\ud83d\udd01 Step 5: Restart Pure-FTPd<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">service pure-ftpd restart<br><\/mark><br>\u2705 Done!<br>Now, every uploaded file under 10MB via FTP will be scanned by ClamAV.<br>You can increase the scan size limit by changing the MAXSIZE variable in the script.<br><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will help you automatically scan all FTP-uploaded files for viruses using ClamAV and Pure-FTPd. \ud83d\udd27 Step 1: Install ClamAV via WHM \ud83d\udee0\ufe0f Step 2: Enable Upload Script Trigger in Pure-FTPd Edit \/etc\/pure-ftpd.conf: nano \/etc\/pure-ftpd.conf Find the line: CallUploadScript noAnd change it to:CallUploadScript yesSave and exit the file.\ud83e\uddea Step 3: Create the ClamAV Upload [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":270,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[253,250,252,251,51,256,255,254],"class_list":["post-269","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel","tag-maxsize","tag-clamav","tag-clamavconnector","tag-manage","tag-plugins","tag-pure-ftpd","tag-restart","tag-summary"],"_links":{"self":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts\/269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/comments?post=269"}],"version-history":[{"count":1,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts\/269\/revisions"}],"predecessor-version":[{"id":271,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts\/269\/revisions\/271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/media\/270"}],"wp:attachment":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/media?parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/categories?post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/tags?post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}