GoAdmio

antivirus

Remove the cron jobs of every user except root and go

On this page: Overview · Quick start · Syntax · Output · Examples · Troubleshooting · Details · See also


Overview

Malware that gets into a hosting account often keeps itself alive by adding a cron job to that user's crontab. /go/antivirus removes that hiding place. It:

It does not scan files and does not use virus signatures. To scan for malware, use clamav or scan.

[!WARNING] The command treats every crontab other than root and go as malware. A legitimate cron job that belongs to another user is deleted too, with no backup and no confirmation. List the crontabs first (see Examples).


Quick start

# See which crontabs would be deleted (RHEL-family path)
ls /var/spool/cron

# Delete them (run as root)
/go/antivirus

Syntax

/go/antivirus

The command takes no arguments or options. Any argument is ignored. Run it as root.


Output

Message Meaning
Deleting Malware <user>... The crontab of <user> was deleted, and /tmp was emptied.
(nothing) Only the root and go crontabs exist, so nothing was deleted.

The command always finishes without an error status.


Examples

# Preview: list the crontab files (AlmaLinux, Rocky, CentOS, Red Hat, Fedora)
ls /var/spool/cron
# Preview: list the crontab files (Debian, Ubuntu)
ls /var/spool/cron/crontabs
# Delete the crontabs of every user except root and go
/go/antivirus
# Review the log of past runs
tail -n 20 /var/log/go/antivirus.log

Troubleshooting

Symptom Likely cause Fix
A cron job stopped working after running the command It belonged to a user other than root or go, so it was deleted. Add the job again under root, or restore it from a backup. See cron and cronjob.
Files in /tmp disappeared The command empties /tmp for every crontab it deletes. None. Programs that keep files in /tmp may need to create them again.
Deleting Malware *... is printed The crontab folder is completely empty, so the * is taken as a file name. Nothing is deleted from the folder, but /tmp is still emptied. None.
Nothing is printed Only root and go have crontabs. None. This is the normal result on a clean server.
The suspicious cron job comes back The command removes the crontab only. The malware that added it is still on the server. Find and remove it with scan and clamav, and change the account's passwords.
Permission denied or a cd error The command was not run as root. Run it as root.

Details

Which crontabs are checked

OS Folder
AlmaLinux, Rocky, CentOS, Red Hat, Fedora /var/spool/cron
Debian, Ubuntu /var/spool/cron/crontabs
Any other OS /var/spool/cron

Each file in the folder is named after the user it belongs to.

What is deleted

Item Result
The crontab of root Kept.
The crontab of go Kept.
The crontab of any other user Deleted, and the message Deleting Malware <user>... is printed.
/tmp/* Deleted, once for each crontab that is removed.

What it does not do

Item Detail
Scanning No files are scanned and no signatures are used.
Backup Deleted crontabs and /tmp files are not saved or quarantined.
Confirmation The command does not ask before deleting.
Cleanup It does not remove the malware that created the cron job.

Logging

Every run appends a timestamp to /var/log/go/antivirus.log.

What a run does

flowchart TD
    A["antivirus"] --> B["Pick the crontab folder for the OS"]
    B --> C["For each file in the folder"]
    C --> D{"root or go?"}
    D -- "Yes" --> E["Keep"]
    D -- "No" --> F["Print: Deleting Malware user"]
    F --> G["Delete the crontab"]
    G --> H["Empty /tmp"]

See also

Command Description
clamav Open-source antivirus engine for malware, viruses, trojans, and threats
scan Scan newly modified PHP files for shells and the root password
cron Set up main cron jobs in GoAdmio
cronjob Manage the per-domain cron job list
uploader Report file uploads or fingerprint a known file
cmd View a report of all commands executed by users