clamd:错误:本地:无法创建套接字目录:/var/run/clamd.scan:权限被拒绝

clamd:错误:本地:无法创建套接字目录:/var/run/clamd.scan:权限被拒绝

在过去 13 天左右(我有日常工作),我似乎无法再在 Centos 7 的干净映像上安装 ClamAV。

/var/日志/消息

Sep 16 14:54:52 ip-172-31-42-25 systemd: Starting clamd scanner (scan) daemon...
Sep 16 14:54:52 ip-172-31-42-25 clamd[25456]: Received 0 file descriptor(s) from systemd.
Sep 16 14:54:52 ip-172-31-42-25 clamd[25456]: clamd daemon 0.103.3 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Sep 16 14:54:52 ip-172-31-42-25 clamd[25456]: Log file size limited to 1048576 bytes.
Sep 16 14:54:52 ip-172-31-42-25 clamd[25456]: Reading databases from /var/lib/clamav
Sep 16 14:54:52 ip-172-31-42-25 clamd[25456]: Not loading PUA signatures.
Sep 16 14:54:52 ip-172-31-42-25 clamd[25456]: Bytecode: Security mode set to "TrustSigned".
Sep 16 14:55:07 ip-172-31-42-25 clamd[25456]: Loaded 8565181 signatures.
Sep 16 14:55:10 ip-172-31-42-25 clamd[25456]: LOCAL: Could not create socket directory: /var/run/clamd.scan: Permission denied
Sep 16 14:55:10 ip-172-31-42-25 clamd: ERROR: LOCAL: Could not create socket directory: /var/run/clamd.scan: Permission denied
Sep 16 14:55:10 ip-172-31-42-25 clamd: ERROR: LOCAL: Socket file /var/run/clamd.scan/clamd.sock could not be bound: No such file or directory
Sep 16 14:55:10 ip-172-31-42-25 clamd[25456]: LOCAL: Socket file /var/run/clamd.scan/clamd.sock could not be bound: No such file or directory
Sep 16 14:55:10 ip-172-31-42-25 systemd: [email protected]: control process exited, code=exited status=1
Sep 16 14:55:10 ip-172-31-42-25 systemd: Failed to start clamd scanner (scan) daemon.
Sep 16 14:55:10 ip-172-31-42-25 systemd: Unit [email protected] entered failed state.
Sep 16 14:55:10 ip-172-31-42-25 systemd: [email protected] failed.
Sep 16 14:55:10 ip-172-31-42-25 systemd: [email protected] holdoff time over, scheduling restart.

目录

ls -la /var/run
lrwxrwxrwx. 1 root root 6 Oct 30  2020 /var/run -> ../run
ls -la /var/run/
total 36
drwxr-xr-x. 26 root   root    800 Sep 16 12:02 .

操作系统

cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

据我所知,SELinux 没有阻止任何内容

[root@ip-172-31-42-25 centos]# audit2allow -a -w
[root@ip-172-31-42-25 centos]# 

现在,这是 CI/CD 的一部分,所以我想我可以添加一个步骤来提前创建目录。但这是正确的解决方案吗?

正如我所见,clam 以 root 身份启动,并且应该具有创建目录的权限?

提前致谢

答案1

mkdir /var/run/clamd.scan

chown clamscan:clamscan /var/run/clamd.scan

systemctl restart clamd@scan

相关内容