![clamd:错误:本地:无法创建套接字目录:/var/run/clamd.scan:权限被拒绝](https://linux22.com/image/195747/clamd%EF%BC%9A%E9%94%99%E8%AF%AF%EF%BC%9A%E6%9C%AC%E5%9C%B0%EF%BC%9A%E6%97%A0%E6%B3%95%E5%88%9B%E5%BB%BA%E5%A5%97%E6%8E%A5%E5%AD%97%E7%9B%AE%E5%BD%95%EF%BC%9A%2Fvar%2Frun%2Fclamd.scan%EF%BC%9A%E6%9D%83%E9%99%90%E8%A2%AB%E6%8B%92%E7%BB%9D.png)
在过去 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