Open jsuto opened 3 months ago
Hi @jsuto sorry you didn't get a response from me way sooner.
You're probably running clamd
as your own user account and it likely does not have permission to open other files to scan them.
If you run clamd
using sudo
or as root, then it should run as the clamav
user. In that cause it probably won't even be able to scan stuff under $HOME
.
Either you should have clamd
run as a user that has read access to everything (not recommended), or else send an INSTREAM or FDPASS scan request. Both INSTREAM and FDPASS will require your program to open the file first in order to send it. That means running your program with sudo/root or else some other user account that just has read access to everything that you need to scan.
INSTREAM will stream the whole file contents over the socket to clamd
. Clamd will write it to a temp file and then scan the temp file.
FDPASS will open the file and send the file handle. We don't have example code/documentation on how to do this, so you'll have to look into the clamdscan
code to figure it out.
Describe the bug
I have an application that writes files to /var/piler/tmp/0 dir. The app uses clamd over the unix socket to pass the file's full path, then read clamd's response whether it's a clean file or not. The problem is that no matter of the ownership or the permissions on the file, it seems that clamd always returns
Access denied. ERROR
message if the file to be scanned is not either in $HOME or /tmp.How to reproduce the problem
I used this code snippet to scan files (reduced to the relevant part only):
clamconf -n output: