ClamAV:ubuntu 上未创建 clamd.ctl 文件

ClamAV:ubuntu 上未创建 clamd.ctl 文件

我有 ubuntu 16.04.6 版本,我正在尝试安装并运行它clamdscan来检查防病毒软件。

我用过网站上提供的安装说明。 IE。

sudo apt-get install clamav
sudo apt-get install clamav-daemon

上述 2 个命令运行正常。但当我尝试通过运行以下命令下载定义(我假设这是上述操作之后的必需操作)时

sudo freshclam

失败并引发以下错误:

^Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory

根据这个被接受的答案,该文件应该在安装后创建clamav-daemon,但显然这并没有发生。

答案1

我在Ubuntu 20.04 LTS机器,

我所做的是:

  1. 跑步sudo systemctl stop clamav-daemon.service
  2. 然后运行sudo rm /var/log/clamav/freshclam.log(有时会被锁定)
  3. 启动服务sudo systemctl start clamav-daemon.service

确保一切正常运行sudo systemctl status clamav-daemon.service,输出应该如下所示:

➜  ~ sudo systemctl status clamav-daemon.service
● clamav-daemon.service - Clam AntiVirus userspace daemon
     Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/clamav-daemon.service.d
             └─extend.conf
     Active: active (running) since Sun 2020-05-03 05:03:51 EEST; 4s ago
       Docs: man:clamd(8)
             man:clamd.conf(5)
             https://www.clamav.net/documents/
    Process: 6122 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)
    Process: 6124 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS)
   Main PID: 6138 (clamd)
      Tasks: 1 (limit: 14203)
     Memory: 367.3M
     CGroup: /system.slice/clamav-daemon.service
             └─6138 /usr/sbin/clamd --foreground=true

May 03 05:03:51 user systemd[1]: Starting Clam AntiVirus userspace daemon...
May 03 05:03:51 user systemd[1]: Started Clam AntiVirus userspace daemon.

现在运行sudo freshclam并检查日志文件(或控制台输出)

Sun May  3 05:04:02 2020 -> --------------------------------------
Sun May  3 05:04:02 2020 -> ClamAV update process started at Sun May  3 05:04:02 2020
Sun May  3 05:04:02 2020 -> daily.cvd database is up to date (version: 25800, sigs: 2331970, f-level: 63, builder: raynman)
Sun May  3 05:04:02 2020 -> main.cvd database is up to date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Sun May  3 05:04:02 2020 -> bytecode.cvd database is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)

享受!

答案2

我发现运行后:

freshclam 

并收到此错误:

Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory

你只需要运行重新启动恶魔:

service clamav-daemon restart

然后freshclam 再重复一遍,一切就正常了。

答案3

为 ClamAV 添加 sock 文件:

sudo touch /var/lib/clamav/clamd.sock
sudo chown clamav:clamav /var/lib/clamav/clamd.sock

然后,编辑/etc/clamav/clamd.conf-取消注释此行:

LocalSocket /var/lib/clamav/clamd.sock

保存文件并重新启动clamav-daemon.service

另一个错误:

sudo freshclam

Downloading daily-25578.cdiff [100%]
Downloading daily-25579.cdiff [100%]
Downloading daily-25580.cdiff [100%]
Downloading daily-25581.cdiff [100%]
Downloading daily-25582.cdiff [100%]
Downloading daily-25583.cdiff [100%]
daily.cld updated (version: 25583, sigs: 1778105, f-level: 63, builder: raynman)
Downloading bytecode-331.cdiff [100%]
bytecode.cld updated (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
Database updated (6344448 signatures) from database.clamav.net (IP: 104.16.219.84)
WARNING: Clamd was NOT notified: Can't connect to clamd through /run/clamav/clamd.ctl: No such file or directory

蛤

为 ClamAV 添加 sock 文件:

sudo touch /run/clamav/clamd.sock
sudo chown clamav:clamav /run/clamav/clamd.sock

sudo systemctl restart clamav-daemon.service
sudo freshclam

ClamAV update process started at Thu Sep 26 11:47:12 2019
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
daily.cld is up to date (version: 25583, sigs: 1778105, f-level: 63, builder: raynman)
bytecode.cld is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)

就是这样。

答案4

如果您遇到此问题,则很可能是 clam 守护进程尚未完全启动。您可以运行“clamd”以同步启动守护进程,然后您应该能够在其完全启动后扫描文件。

相关内容