Purpose:
Linux Malware Detect (LMD), or maldet, is a malware scanner for Linux, designed to detect and clean infected files on shared hosting environments.
📥 Step 1: Download and Install
Open SSH and log in as root, then run the following:
rm -fv maldetect-current.tar.gz
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -zxf maldetect-current.tar.gz
cd maldetect-*
./install.sh
This will install maldet to /usr/local/maldetect.
⚙️ Step 2: Configuration
Edit the configuration file:
nano /usr/local/maldetect/conf.maldet
Suggested options to review/update:
email_alert=1
email_addr="your@email.com"
quar_hits=1
quar_clean=1
Enable alerts, quarantine, and auto-cleaning as needed.
Save and exit: CTRL+X, then Y, then Enter.
🧪 Step 3: Run a Scan
Scan All:
maldet -a /
Background Scan on Specific Directory:
maldet -b -r /home/username/
The
-bflag runs in background, and-renables recursive scanning.
🔄 Optional: Set Up Cron for Daily Scans
Create a cron job:
crontab -e
Add:
0 3 * * * /usr/local/maldetect/maldet -b -r /home >> /var/log/maldet-daily.log 2>&1
✅ Final Notes
- Use with ClamAV for enhanced scanning:
yum install clamavordnf install clamav(on AlmaLinux 8/9). - Logs:
/usr/local/maldetect/event_log - Quarantine:
/usr/local/maldetect/quarantine/
