Installing Linux Malware Detect (LMD) and ClamAV to scan for malware on Linux

Linux Malware Detect (Maldet)is malware detection and removal software for Linux servers, released as open source under the GNU GPLv2 and designed specifically to detect threats in cloud hosting, cloud VPS and server environments.

It uses sample data from Cloud Hosting providers to extract malware patterns and generate common signatures. These signatures are fed into dedicated antivirus software such as ClamAV and embedded in routine scans to detect malicious code hidden within a website's otherwise ordinary files.

HiTechCloud bringsMaldetapplied to the system with appropriate customizations in order to optimize operation in the Cloud Hosting environment in Vietnam. When malware is detected, HiTechCloud customers receive a notification email so they can act in time and avoid having the website or domain temporarily locked and their business disrupted.

In this article, HiTechCloud shows you how to install LMD on your VPS/Server. You need to log in to the VPS over SSH with root privileges. The installation is fast and straightforward.

1. Install Linux Malware Detect

We begin the installation with the following commands:

wget http://www.rfxn.com/downloads/maldetect-current.tar.gz 
tar -xvf maldetect-current.tar.gz
ls -l | grep maldetect
./install.sh

LMD automatically creates a cron job in the directory/etc/cron.daily/maldetso LMD runs automatically.

2. Configure Linux Malware Detect

email_alert=1 
email_addr=your@email.com 
email_subj="Malware alerts for $HOSTNAME - $(date +%Y-%m-%d)" 
quar_hits=1 
quar_clean=1 
clam_av=1 

With:
– email_alert=1: Enable email notifications.
– mail_addr=”your@email.com”: Enter your email.
– quar_hits=1: during a scan, if malware is found, LMD moves the infected file into its own quarantine directory.
– quar_clean=1: LMD will clean the file if malware is detected.
– clam_av=1: Use ClamAV as the scan engine if it is installed on the VPS.

3. Commands for using Linux Malware Detect

– To scan a specific directory on the VPS, use the following command:

maldet -a /home/dir

Replace /home/dir with the path to your own folder.

Update LMD with the command:

maldet -u

4. Remove Malware Detect

If for any reason you no longer want to use LMD (Maldet), you can remove it from the server. Maldet has no built-in uninstall function, so use the following command instead:

wget -q -O - http://attachfile.vdrs.net/mb-maldet-remove | sh

5. Install ClamAV

For more effective malware scanning, install ClamAV as well. Once ClamAV is installed, LMD uses it as the scan engine, improving scan speed and effectiveness.

Install ClamAV on Ubuntu, Debian:

sudo apt-get install clamav clamav-daemon -y

Install ClamAV on CentOS:

sudo yum install -y clamav-server clamav-server-systemd clamav-scanner-systemd clamav-data clamav-update clamav-filesystem clamav clamav-devel clamav-lib

Install ClamAV on AlmaLinux

sudo dnf install epel-release -y
sudo dnf update -y
sudo dnf yum -y install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd
setsebool -P antivirus_can_scan_system 1
setsebool -P clamd_use_jit 1
freshclam

Good luck.

Similar Posts