How to Install ClamAV, Linux Malware Detect, and RKhunter Anti-Virus Software and Effectively Scan for Viruses, Malware, Trojans on Ubuntu 22.04/20.04 Linux
Detect and Eliminate Viruses Using ClamAV on Ubuntu
ClamAV is a leading free and open-source antivirus program, widely recognized as a versatile toolkit for scanning for viruses on Ubuntu 22.04 and other Linux systems. It is designed to detect trojans, viruses, malware, and various malicious threats. Additionally, it serves as a standard email scanner, supporting most email file formats.
ClamAV Features
- Cross-platform: works on Ubuntu, Linux, Windows, and MacOS.
- Easy to install and easy to use.
- Work mainly on the command-line interface.
- Support scan on access (Linux only).
- The virus database is updated regularly.
Install ClamAV and scan virus
Press Ctrl + Alt + T to open Terminal and run the install command below
sudo apt update && sudo apt upgrade -y
sudo apt-get install clamav clamav-daemon
Next is to run the command to update the virus database for ClamAV.
sudo systemctl stop clamav-freshclam.service
sudo freshclam
sudo systemctl start clamav-freshclam.service
To scan files with anti-virus for Ubuntu 22.04 or Linux, just run the command below or refer to the instructions from the ClamAV homepage.
sudo clamscan -r /folder
An example is when I scan for viruses and malicious code in pictures folder.
If, after executing the scan command, ‘Infected files’ identifies a file with malicious code, you have the option to handle it manually or execute the command below to scan for viruses on Ubuntu 22.04 and delete the infected file.
sudo clamscan --infected --remove --recursive /thumuc
The full scan command system
sudo clamscan --infected --recursive --exclude-dir="^/sys" /
To test the infected
file, you can download the file below and scan it.
wget http://www.eicar.org/download/eicar.com
Rkhuner: A Powerful Antivirus Solution for Ubuntu 22.04
Rkhunter is a popular choice for scanning for viruses on Ubuntu 22.04, as it effectively identifies rootkits and general vulnerabilities. It can be easily installed using the package manager.
Rkhunter Features
- Find out the default file used by the rootkit.
- Wrong powers of binary program.
- Look for unusual sequences in the LKM and KLD departments.
- The antivirus for ubuntu can find hidden files.
- Customize scan type with plaintext and binary files.
- Perform trojan-specific testing like xinetd service test.
- Perform malware detection include check login credentials for backdoors, rogue log files, and other suspicious directories.
- Perform a boot system check.
Install and Use Rkhunter Scan Virus on Linux
Press Ctrl + Alt + T to open Terminal and run the install command below
sudo apt update && sudo apt upgrade -y
sudo apt-get install rkhunter
After installing and before scan for viruses on Ubuntu 22.04, you need to update the file properties database.
sudo rkhunter --propupd
This allows rkhunter
to know the current status of certain files to prevent some false alarms. After updating, or run the command below to scan the file.
sudo rkhunter --checkall
Then you can view the log scan with this command.
sudo cat /var/log/rkhunter.log | grep -i warning
In addition to the above information, you can read more on rkhunter’s page
Install Malware Detect – Antivirus for Linux
Linux Malware Detect (maldet or LMD), in combination with ClamAV (Antivirus Engine), forms a highly effective duo of tools to scan for viruses on Ubuntu 22.04 Linux, eliminating various malware such as viruses, spyware, and adware from your VPS/Server.
Install Malware Detect on Ubuntu Linux
LMD is not available on the base repositories as pre-made repositories, but you can download LMD as a tarball from the official website.
Download the latest version of LMD using the command below. Can use wget or curl
cd /tmp/
curl -O http://www.rfxn.com/downloads/maldetect-current.tar.gz
Next is to extract the file and install the latest version, currently 1.6.4, and replace * with the version you download.
tar -zxvf maldetect-current.tar.gz
cd maldetect-*
bash install.sh
Setup Malware Detect
Now we will config the anti-virus software for ubuntu Malware Detect to work and edit the conf.maldet file according to the instructions below can use nano or gedit
, sublime text.
sudo nano /usr/local/maldetect/conf.maldet
Find and modify the config, the config may change according to the version of the config below, if you don’t find it, ignore it.
Scan viruses using Malware Detect
To scan for viruses on Linux/Ubuntu or detect malicious code in a folder, you can also use the following command:
maldet --scan-all /folder
If you want to scan only certain file types (e.g. PHP) you can use the following command:
maldet --scan-all /folder/*.php
To view the log report you use the command maldet –report 14715-1421.3219 with the corresponding SCANID.
Update LMD with the command:
maldet -u
To delete all quarantined files use the command
sudo rm -rf /usr/local/maldetect/quarantine/*
You can also refer to the scan options on the Malware Detect page
Above are some of the best antivirus software for Linux OS, including ClamAV, Rkhunter, and Malware Detect. They prepare you to efficiently scan for viruses on Ubuntu 22.04, for example, and handle virus-infected files. Hope it helps!