Skip to content

Instantly share code, notes, and snippets.

@thiagozs
Created August 14, 2025 17:22
Show Gist options
  • Save thiagozs/09f63c15aa9d4e2f31415db270c58ae1 to your computer and use it in GitHub Desktop.
Save thiagozs/09f63c15aa9d4e2f31415db270c58ae1 to your computer and use it in GitHub Desktop.
ClamAV Freshclam sem sudo

Configurando ClamAV Freshclam para rodar sem sudo

Este guia mostra como permitir que o usuário thiagozs execute o freshclam sem precisar de permissões de root, corrigindo o erro:

ERROR: Failed to open log file /var/log/clamav/freshclam.log: Permission denied
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!

1️⃣ Adicionar o usuário ao grupo clamav

sudo usermod -aG clamav thiagozs

2️⃣ Ajustar permissões do diretório de log

sudo chown -R clamav:clamav /var/log/clamav
sudo chmod -R 775 /var/log/clamav

3️⃣ Criar (ou ajustar) o arquivo de log

sudo touch /var/log/clamav/freshclam.log
sudo chown clamav:clamav /var/log/clamav/freshclam.log
sudo chmod 664 /var/log/clamav/freshclam.log

4️⃣ Recarregar grupos da sessão

newgrp clamav

5️⃣ Executar atualização sem sudo

freshclam

✅ Exemplo de execução bem-sucedida

ClamAV update process started at Thu Aug 14 14:19:05 2025
daily database available for update (local version: 27725, remote version: 27732)
Downloading database patch # 27726...
...
Database test passed.
daily.cld updated (version: 27732, sigs: 2076427, f-level: 90, builder: raynman)
main.cvd database is up-to-date
bytecode.cld database is up-to-date
Clamd successfully notified about the update.

Agora o freshclam pode ser executado diretamente pelo usuário thiagozs sem necessidade de root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment