How to Install and Use Linux Malware Detect (LMD)

Linux Malware Detect (LMD) is a malware scanner for Linux distribution, Which is released under the GNU GPLv2 license. That is especially designed to find the threats in shared hosted environments because in shared environment thousand plus users are sharing the resources. Each and every user will upload different things and script, etc., 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.
Linux Malware Detect

LMD Features

  • MD5 file hash detection for quick threat identification
  • Statistical analysis component for detection of obfuscated threats
  • Integrated detection of ClamAV to use as scanner engine for improved performance
  • Scan-recent option to scan only files that have been added/changed in X days
  • Scan-all option for full path based scanning
  • Checkout option to upload suspected malware to for review/hashing
  • Full reporting system to view current and previous scan results
  • Quarantine queue that stores threats in a safe fashion with no permissions
  • Quarantine batching option to quarantine the results of a current or past scans
  • Quarantine restore option to restore files to original path, owner and perms
  • Quarantine suspend account option to Cpanel suspend or shell revoke users
  • Cleaner rules to attempt removal of malware injected strings
  • Cleaner batching option to attempt cleaning of previous scan reports
  • Cleaner rules to remove base64 and gzinflate(base64 injected malware
  • Daily cron based scanning of all changes in last 24h in user homedirs
  • Daily cron script compatible with stock RH style systems, Cpanel & Ensim
  • Kernel based inotify real time file scanning of created/modified/moved files
  • Kernel inotify monitor that can take path data from STDIN or FILE
  • Kernel inotify monitor convenience feature to monitor system users
  • Kernel inotify monitor can be restricted to a configurable user html root
  • Kernel inotify monitor with dynamic sysctl limits for optimal performance
  • Kernel inotify alerting through daily and/or optional weekly reports
  • E-mail alert reporting after every scan execution (manual & daily)
  • Path, extension and signature based ignore options
  • Background scanner option for unattended scan operations
  • Download Linux Malware Detect

    Linux Malware Detect is not available in any online repository. So you need to download the source code of LMD using below command:

    # wget

    Extract and Install Linux Malware Detect

    After downloading the source code you need to extract the archive file and install the Linux Malware Detect following below steps.

    # tar -xvf maldetect-current.tar.gz
    # cd maldetect-1.5
    # ./

    Linux Malware Detect Installation

    Configure Linux Malware Detect

    You need to configure LMD through “/usr/local/maldetect/conf.maldet” configuration file. By default all the option are commented in configuration file so we need to do changes accordingly.

    # vim /usr/local/maldetect/conf.maldet
    # To get email alert #
    # Add your e-mail id to get email alert #
    # Add email subject #
    email_subj="Malware alerts for $HOSTNAME - $(date +%Y-%m-%d)"
    # To move malware to quarantine & alert #
    # Clean injected malware #
    # To suspend/disable your wish #
    # To set minimum user id that can be suspended #

    Note: You can do changes as per your requirement.

    Scan the System

    After configuring, you can scan the system manually using the following command:

    # maldet --scan-all /
    Linux Malware Detect v1.5
                (C) 2002-2016, R-fx Networks 
                (C) 2016, Ryan MacDonald 
    This program may be freely redistributed under the terms of the GNU GPL v2
    maldet(8097): {scan} signatures loaded: 11294 (9343 MD5 / 1951 HEX / 0 USER)
    maldet(8097): {scan} building file list for "/", this might take awhile...
    maldet(8097): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6
    maldet(8097): {scan} file list completed in 0s, found 20620 files...
    maldet(8097): {scan} scan of "/" (20620 files) in progress...
    maldet(8097): {scan} scan completed on "/": files 20620, malware hits 0, cleaned hits 0, time 117s
    maldet(8097): {scan} scan report saved, to view run: maldet --report 170210-0351.8097

    After scanning, you can examine malware scan report by running the following command:

    # maldet --report 170210-0351.8097
    SCAN ID:   170210-0351.8097
    STARTED:   Feb 10 2017 03:51:48 -0600
    COMPLETED: Feb 10 2017 03:53:45 -0600
    ELAPSED:   117s [find: 0s]
    PATH:          "/"
    TOTAL FILES:   20620
    TOTAL HITS:    0
    Linux Malware Detect v1.5 < >

    You can also scan the specific filesystem on server.

    # maldet -m /var,/home,/opt

    Quarantine the Infected Files

    Run the following command with the scan report ID to clean the effected files.

    # maldet -q 170210-0351.8097

    Update LMD & Signatures to Latest

    Use below both command to update your LMD version & virus signatures to latest.
    # Update the installed version #

    # maldet -d

    # Update malware detection signatures #

    # maldet -u

    Enjoy it!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.