Ensuring your server’s security is essential for protecting it from numerous dangers, such as malware. Malware refers to a wide spectrum of destructive software intended to compromise systems, steal data, or disrupt activities. Because servers are used a lot for essential tasks like hosting websites, databases, or applications, it is crucial to implement strong security measures, such as malware detection and prevention.
Here are some ways and tools to check for malware on Linux servers, as well as guidelines for how to install them:
ClamAV
ClamAV is an important open-source antivirus application that is available across major Linux distributions. It can check files and folders for known malware signatures.
1. Install ClamAV with the following command.
apt-get install clamav clamav-daemon
2. After installing ClamAV, you should update its virus database.To run the updater application, use the commands given below.
systemctl stop clamav-freshclam
freshclam
3. After updating, start and enable the services.
systemctl start clamav-freshclam
systemctl enable clamav-freshclam
4. After completing the steps above, scan your home directory of websites or the directory you want to scan using the command.
clamscan -ir /home/* > Test.txt
-i: This option instructs clamscan to only display infected files.
-r: This option instructs clamscan to scan directories recursively.
/home/*: This is the path to the directory you want to scan. It will scan all files within the home directory.
> Test.txt: This part of the command redirects the output of the clamscan command to a file named Test.txt.
The > symbol is used for output redirection, and it will create or overwrite the file with the scan results.
Rkhunter
Rootkit Hunter (rkhunter) examines the system for known rootkits, backdoors, and other harmful files.
- Install the package manager using the following command.
apt-get install rkhunter
2. After installing, update the file properties database using the command
rkhunter --propupd
3. After the update, start the scanner using the following command.
rkhunter --checkall
4.The scanner runs, checks for actual rootkits and malware, and generates a summary to a log file.
view the log file using the command below
cat /var/log/rkhunter.log
Examine the output to see what you can do to improve your system security.
By implementing the security solutions described above, you can more effectively secure your Linux server from attacks and vulnerabilities.
Our Technical Team will be available to assist you with Ways to check for malware on an Ubuntu server that can make your job a lot easier. Get in Touch with Skynats if you have any queries.