Antivirus & Antimalware for Linux Servers

Home / Blog / Antivirus & Antimalware for Linux Servers

Antivirus & Antimalware for Linux Servers

Posted:  September 21, 2021

Antivirus & Antimalware for Linux Servers

Scanning your system for different types of unwanted programs can help identify issues, or at least give you the peace of mind for having a clean server.

There are multiple options for making sure your server is clean of any malware, this guide goes over the top scanning software you can utilize for checking your system, keeping your servers clean, and your files safe.

ClamAV

ClamAV is a popular open source antivirus engine available on a multitude of platforms including the majority of Linux distributions. Install it with the command below.

sudo apt-get install clamav clamav-daemon

With the required modules installed, next, you should update the virus database for ClamAV by running the updater application.

sudo freshclam

When you’ve finished updating the virus definitions, do a test scan to your home directory just to make sure the scanning works as it should use the following command.

sudo clamscan -r /home

Granted that your home directory didn’t contain any viruses or other types of malware, the scan should come back empty.

So how do you know it works?

For this, you can download an anti-virus test file, which is a small completely harmless program that most anti-virus software report as infected, though with an obvious test file name EICAR-AV-Test. Use the following command to download the test file to your home directory.

wget -P ~/ http://www.eicar.org/download/eicar.com

Now scan your home folder again with the same command as above, you should receive notice of one infected file at the end summary after the scan is completed. When you’ve confirmed that ClamAV finds the test file correctly, use the command below to scan it again and remove the infected file once found.

sudo clamscan --infected --remove --recursive /home

Be careful when using the –remove parameter. First, run a broader scan without it, and then more localized scan when removing files or remove them manually.

To perform a complete scan of your cloud server, use this command

sudo clamscan --infected --recursive --exclude-dir="^/sys" /

The scan goes through each directory in your system root recursively, but skips /sys just to avoid unnecessary warning printouts, as the virtual file system consists of some unreadable files, which could not contain viruses anyway.

Rkhunter

Rkhunter is a common option for scanning your system for rootkits and general vulnerabilities. It can be easily installed using the package manager.

sudo apt-get install rkhunter

Once installed and before scanning, you’ll need to update the file properties database.

sudo rkhunter --propupd

This lets the scanner to know the current state of certain files to prevent some false alarms. After the update, simply start the scanner with the following.

sudo rkhunter --checkall

The scanner runs through some system commands, checks for actual rootkits and some malware, network and local host settings, and then gives you the summary as well as recording the findings to a log file.

Afterwards, you can get a condensed look at the scan log with this command.

sudo cat /var/log/rkhunter.log | grep -i warning

Go through the output to get some tips on what you could do to improve your system security.

Chkrootkit

Chkrootkit is another popular rootkit scanner, which runs a lot of useful checks and can direct suspicions towards finding a solution. It can be installed on most distributions with the package manager, on an Ubuntu systems use the following.

sudo apt-get install chkrootkit

Once done, scan your server with this command.

sudo chkrootkit

The scan will check for many types of infections and print out its findings. You can scroll through the output to check for any warnings. Note that on Ubuntu 14.04 using chkrootkit version 0.49 it’s possible to get a false positive warning for Suckit rootkit, use rkhunter to double check.

Chkrootkit doesn’t write report other than outputting to the screen by default, but if you wish to automate the checks or to take a look at the findings later, use tee to redirect the printout to a log file.

sudo chkrootkit | sudo tee /var/log/chkrootkit/chkrootkit.log

You can then check the log for any warnings.

sudo cat /var/log/chkrootkit/chkrootkit.log | grep -i warning

While chkrootkit can be used to help determine if a machine has been compromised, it shouldn’t be taken as the ‘final word’, use it in conjunction with other scanners to diagnose any possible infections.

Maldet

Linux Malware Detect (LMD) is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection. In addition, threat data is also derived from user submissions with the LMD checkout feature and from malware community resources. The signatures that LMD uses are MD5 file hashes and HEX pattern matches, they are also easily exported to any number of detection tools such as ClamAV.

It is a bit of a process to install, but well worth utilizing. To install make sure you are shelled into your server and run the following commands:

sudo mkdir -p /usr/local/src/maldetect-current
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz -P /usr/local/src/
tar -xzf /usr/local/src/maldetect-current.tar.gz -C /usr/local/src/maldetect-current
sudo mv /usr/local/src/maldetect-current/* /usr/local/src/maldetect-current/maldet/
cd /usr/local/src/maldetect-current/maldet/
sudo bash install.sh

Let the install complete then remove the /usr/local/src/maldetect-current directory. Once removed open/create the text file /usr/local/maldetect/monitor_paths and type in the paths you wish to monitor. This will monitor the paths continuously scanning for threats.

To update simply shell into your server and run sudo maldet -u && sudo maldet -d

If you wish to manually scan a path, run the following command and replace THE_PATH with the path you wish to scan sudo maldet -a /THE_PATH, not that you can use wildcards in THE_PATH if you wish.

Kevin Pirnie

20+ Years of PC and server maintenance & over 15+ years of web development/design experience; you can rest assured that I take every measure possible to ensure your computers are running to their peak potentials. I treat them as if they were mine, and I am quite a stickler about keeping my machines up to date and optimized to run as well as they can.

Cookie Notice

This site utilizes cookies to improve your browsing experience, analyze the type of traffic we receive, and serve up proper content for you. If you wish to continue browsing, you must agree to allow us to set these cookies. If not, please visit another website.

Antivirus & Antimalware for Linux Servers

Scanning your system for different types of unwanted programs can help identify issues, or at least give you the peace of mind for having a clean server.

There are multiple options for making sure your server is clean of any malware, this guide goes over the top scanning software you can utilize for checking your system, keeping your servers clean, and your files safe.

ClamAV

ClamAV is a popular open source antivirus engine available on a multitude of platforms including the majority of Linux distributions. Install it with the command below.

sudo apt-get install clamav clamav-daemon

With the required modules installed, next, you should update the virus database for ClamAV by running the updater application.

sudo freshclam

When you’ve finished updating the virus definitions, do a test scan to your home directory just to make sure the scanning works as it should use the following command.

sudo clamscan -r /home

Granted that your home directory didn’t contain any viruses or other types of malware, the scan should come back empty.

So how do you know it works?

For this, you can download an anti-virus test file, which is a small completely harmless program that most anti-virus software report as infected, though with an obvious test file name EICAR-AV-Test. Use the following command to download the test file to your home directory.

wget -P ~/ http://www.eicar.org/download/eicar.com

Now scan your home folder again with the same command as above, you should receive notice of one infected file at the end summary after the scan is completed. When you’ve confirmed that ClamAV finds the test file correctly, use the command below to scan it again and remove the infected file once found.

sudo clamscan --infected --remove --recursive /home

Be careful when using the –remove parameter. First, run a broader scan without it, and then more localized scan when removing files or remove them manually.

To perform a complete scan of your cloud server, use this command

sudo clamscan --infected --recursive --exclude-dir="^/sys" /

The scan goes through each directory in your system root recursively, but skips /sys just to avoid unnecessary warning printouts, as the virtual file system consists of some unreadable files, which could not contain viruses anyway.

Rkhunter

Rkhunter is a common option for scanning your system for rootkits and general vulnerabilities. It can be easily installed using the package manager.

sudo apt-get install rkhunter

Once installed and before scanning, you’ll need to update the file properties database.

sudo rkhunter --propupd

This lets the scanner to know the current state of certain files to prevent some false alarms. After the update, simply start the scanner with the following.

sudo rkhunter --checkall

The scanner runs through some system commands, checks for actual rootkits and some malware, network and local host settings, and then gives you the summary as well as recording the findings to a log file.

Afterwards, you can get a condensed look at the scan log with this command.

sudo cat /var/log/rkhunter.log | grep -i warning

Go through the output to get some tips on what you could do to improve your system security.

Chkrootkit

Chkrootkit is another popular rootkit scanner, which runs a lot of useful checks and can direct suspicions towards finding a solution. It can be installed on most distributions with the package manager, on an Ubuntu systems use the following.

sudo apt-get install chkrootkit

Once done, scan your server with thisĀ command.

sudo chkrootkit

The scan will check for many types of infections and print out its findings. You can scroll through the output to check for any warnings. Note that on Ubuntu 14.04 using chkrootkit version 0.49 it’s possible to get a false positive warning for Suckit rootkit, use rkhunter to double check.

Chkrootkit doesn’t write report other than outputting to the screen by default, but if you wish to automate the checks or to take a look at the findings later, use tee to redirect the printout to a log file.

sudo chkrootkit | sudo tee /var/log/chkrootkit/chkrootkit.log

You can then check the log for any warnings.

sudo cat /var/log/chkrootkit/chkrootkit.log | grep -i warning

While chkrootkit can be used to help determine if a machine has been compromised, it shouldn’t be taken as the ‘final word’, use it in conjunction with other scanners to diagnose any possible infections.

Maldet

Linux Malware Detect (LMD) is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection. In addition, threat data is also derived from user submissions with the LMD checkout feature and from malware community resources. The signatures that LMD uses are MD5 file hashes and HEX pattern matches, they are also easily exported to any number of detection tools such as ClamAV.

It is a bit of a process to install, but well worth utilizing. To install make sure you are shelled into your server and run the following commands:

sudo mkdir -p /usr/local/src/maldetect-current
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz -P /usr/local/src/
tar -xzf /usr/local/src/maldetect-current.tar.gz -C /usr/local/src/maldetect-current
sudo mv /usr/local/src/maldetect-current/* /usr/local/src/maldetect-current/maldet/
cd /usr/local/src/maldetect-current/maldet/
sudo bash install.sh

Let the install complete then remove the /usr/local/src/maldetect-current directory. Once removed open/create the text file /usr/local/maldetect/monitor_paths and type in the paths you wish to monitor. This will monitor the paths continuously scanning for threats.

To update simply shell into your server and run sudo maldet -u && sudo maldet -d

If you wish to manually scan a path, run the following command and replace THE_PATH with the path you wish to scan sudo maldet -a /THE_PATH, not that you can use wildcards in THE_PATH if you wish.

Our Privacy Policy

Last Updated: June 18th, 2025

Introduction

Western Mass Hosting (“we,” “our,” or “us”) respects the privacy of all individuals and organizations that interact with our services. This Privacy Policy establishes our practices regarding the collection, use, disclosure, and protection of personal information for visitors to our website and clients utilizing our managed hosting and WordPress services. By accessing our website or engaging our services, you acknowledge that you have read and understood this policy in its entirety.

Scope and Applicability

This Privacy Policy governs our handling of information collected through our corporate website and in the course of providing managed hosting, WordPress maintenance, and development services. In accordance with global privacy regulations, we serve as a Data Controller for information related to our business operations and client relationships. When processing data on behalf of our clients through hosted services, we act as a Data Processor under applicable data protection laws.

Information We Collect

We collect various categories of information necessary to provide and improve our services. This includes personal contact and payment details provided during account registration, technical information such as IP addresses and device characteristics for security purposes, and records of communications through support channels. For clients utilizing our hosting services, we may process end-user data stored within client websites, though we do not control or monitor the collection practices of such data.

Purpose and Legal Basis for Processing

We process personal information only when we have proper justification under applicable laws. The primary legal bases for our processing activities include the necessity to fulfill contractual obligations to our clients, our legitimate business interests in maintaining and improving our services, and in limited cases, explicit consent for specific marketing communications. We maintain detailed records of processing activities to demonstrate compliance with legal requirements.

Use of Collected Information

The information we collect serves multiple business purposes. Primarily, we use this data to deliver and maintain reliable hosting services, including server provisioning, performance monitoring, and technical support. We also utilize information for business operations such as billing, customer relationship management, and service improvement initiatives. Security represents another critical use case, where we analyze data to detect and prevent fraudulent activity or unauthorized access to our systems.

Data Sharing and Third-Party Disclosures

We engage with carefully selected third-party service providers to support our operations, including cloud infrastructure providers, payment processors, and customer support platforms. These relationships are governed by strict contractual agreements that mandate appropriate data protection measures. We may disclose information when legally required to comply with court orders, government requests, or to protect our legal rights and the security of our services.

International Data Transfers

As a global service provider, we may transfer and process data in various locations worldwide. When transferring personal data originating from the European Economic Area or other regulated jurisdictions, we implement appropriate safeguards such as Standard Contractual Clauses and rely on adequacy decisions where applicable. Our subprocessors, including AWS Lightsail, maintain robust compliance certifications to ensure the protection of transferred data.

Data Retention Practices

We retain personal information only for as long as necessary to fulfill the purposes outlined in this policy. Client account information is typically maintained for five years following service termination to comply with legal and financial reporting obligations. Backup data associated with hosting services is automatically purged after thirty days, as specified in our Terms of Service. For data processed on behalf of clients, retention periods are determined by the respective client’s policies and instructions.

Security Measures

We implement comprehensive technical and organizational security measures to protect personal information against unauthorized access, alteration, or destruction. Our security program includes network encryption protocols, regular vulnerability assessments, strict access controls, and employee training on data protection best practices. We maintain incident response procedures to address potential security breaches and will notify affected parties where required by law.

Individual Rights

Individuals whose personal data we process may exercise certain rights under applicable privacy laws. These rights may include requesting access to their information, seeking correction of inaccurate data, requesting deletion under specific circumstances, and objecting to particular processing activities. We have established procedures to handle such requests in accordance with legal requirements, typically responding within thirty days of receipt. Requests should be submitted to our designated Data Protection Officer through the contact information provided in this policy.

Cookies and Tracking Technologies

Our website employs various technologies to enhance user experience and analyze site performance. Essential cookies are used for basic functionality and security purposes, while analytics cookies help us understand how visitors interact with our site. Marketing cookies are only deployed with explicit user consent. Visitors can manage cookie preferences through their browser settings or our cookie consent tool.

Policy Updates and Notifications

We periodically review and update this Privacy Policy to reflect changes in our practices or legal obligations. Material changes will be communicated to affected clients through email notifications at least thirty days prior to implementation. Continued use of our services following such notifications constitutes acceptance of the revised policy.

Contact Information

For questions or concerns regarding this Privacy Policy or our privacy practices, please contact our Data Protection Officer at info@westernmasshosting.com or by mail at:

Western Mass Hosting
22 Orlando. St.,
Feeding Hills, MA 01030.

We take all privacy-related inquiries seriously and will respond promptly to legitimate requests. For clients with specific data processing agreements, please reference your contract for any additional terms that may apply to our handling of your data.