![sudo freshclam 不工作:错误:无法以附加模式打开 /var/log/clamav/freshclam.log(检查权限!)](https://linux22.com/image/1059192/sudo%20freshclam%20%E4%B8%8D%E5%B7%A5%E4%BD%9C%EF%BC%9A%E9%94%99%E8%AF%AF%EF%BC%9A%E6%97%A0%E6%B3%95%E4%BB%A5%E9%99%84%E5%8A%A0%E6%A8%A1%E5%BC%8F%E6%89%93%E5%BC%80%20%2Fvar%2Flog%2Fclamav%2Ffreshclam.log%EF%BC%88%E6%A3%80%E6%9F%A5%E6%9D%83%E9%99%90%EF%BC%81%EF%BC%89.png)
如果我像这样注释掉 UpdateLogFile 行/etc/clamav/freshclam.conf
...
\#UpdateLogFile /var/log/clamav/freshclam.log
...然后我就可以毫无问题地运行 sudo freshclam 了:
/etc/clamav$ sudo freshclam ClamAV update process started at Mon Feb
6 00:17:07 2017 main.cvd is up to date (version: 57, sigs: 4218790,
f-level: 60, builder: amishhammer) daily.cld is up to date (version:
23009, sigs: 1509149, f-level: 63, builder: neo) bytecode.cld is up to
date (version: 290, sigs: 55, f-level: 63, builder: neo)
但是,如果我取消注释 freshclam.conf 中的 UpdateLogFile 行并运行 sudo freshclam,我会得到以下信息:
/etc/clamav$ sudo freshclam
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
以下是 的权限/var/log
:
drwxrwxrwx 1 root root 9 Feb 3 2016 log
以下是 的权限/var/log/clamav
:
drwxr-xr-x 2 clamav clamav 4096 Feb 5 22:18 clamav
以下是 的权限/var/log/clamav/freshclam.log
:
-rw-r----- 1 clamav adm 0 Feb 5 22:18 freshclam.log
我花了一整天时间尝试各个论坛中提到的解决方案,但没有成功。
这是我正在运行的 Ubuntu 服务器的版本:
Description: Ubuntu 14.04.5 LTS
以及 clamav 的引擎版本:
Engine version: 0.99.2
有人能帮助我吗?
停止 clamav-daemon 没有帮助:
/var/log$ sudo /etc/init.d/clamav-daemon stop
* Stopping ClamAV daemon clamd
[ OK ] /var/log$ sudo freshclam
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check
permissions!). ERROR: Problem with internal logger (UpdateLogFile =
/var/log/clamav/freshclam.log).
输出为sudo lsof | grep clam
空:
/var/log$ sudo lsof | grep clam
/var/log$
似乎没有任何东西可以锁定/var/log/clamav/freshclam.log
以下是 的输出sudo service --status-all | grep clamav
,不包括带有问号且与 clamav 无关的行:
$ sudo service --status-all | grep clamav
[ - ] clamav-daemon
[ - ] clamav-freshclam
$
Can't open /var/log/clamav/freshclam.log in append mode (check permissions!)
当我尝试运行 clamav-daemon 时出现同样的错误:
$ sudo service clamav-daemon start
* Starting ClamAV daemon clamd
ERROR: Can't open /var/log/clamav/clamav.log in append mode (check permissions!).
ERROR: Can't initialize the internal logger
$
更新:清除并重新安装clamav
,clamav-freshclam
但clamav-daemon
问题仍未解决。我仍然收到相同的错误:
$ sudo freshclam
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
$
更新2:我执行了sudo reboot
,停止了clamav-freshclam
,确保sudo lsof | grep clam
没有返回任何内容,并且 的输出仍然只在和sudo service --status-all | grep clamav
旁边有减号。再次运行,再次出现与上述相同的错误。clamav
clamav-daemon
sudo freshclam
答案1
sudo freshclam
命令用于更新您的防病毒数据库,当另一个实例(自动更新)已运行时,该命令无法运行。
停止自动更新过程:
sudo /etc/init.d/clamav-freshclam stop
运行手动更新:sudo freshclam
重新启动自动更新过程:sudo /etc/init.d/clamav-freshclam start
来源。
答案2
我也遇到了这个问题,我真正需要做的就是设置日志文件的权限:
chown -R clamav:adm /var/log/clamav/
答案3
对我来说,我找不到该/var/log/clamav/
目录,因此我只是创建了它:
mkdir /var/log/clamav/
并改变所有权:
chown -R clamav:clamav /var/log/clamav/
而且它成功了!
答案4
我使用了该命令sudo freshclam
,但一直超时。不过,我能够下载主数据库
下载文件名为 main.cvd,大小为 112.4 Mb。其中有一个 178.4 Mb 的文件/var/lib/clamav/daily.cld
,其时间戳为今天的日期。
看来我已经了解最新情况了?