clamd not changing user in freebsd

After some upgrade of clamav it no longer started as the proper user. They try to start as the default clamav user which does not work for me.
This is the error:

Starting clamav_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).
/usr/local/etc/rc.d/clamav-freshclam: WARNING: failed to start clamav_freshclam


# /usr/local/etc/rc.d/clamav-clamd start    
Starting clamav_clamd.
ERROR: LOCAL: Socket file /var/run/clamav/clamd could not be bound: Permission denied

I figured out what went wrong. the FreeBSD rc script starts clamd as clamav so then clamd itself does not have the power to change users. If you add this to your /etc/rc.conf, it may fix your problem as it did mine:


Obviously vscan should be whatever user you need to start the services as. Note that if you put “root” in there, then that makes it so clamd and freshclam have the power to change users (so if it is in the config they can do that now).

Leave a Reply

Your email address will not be published. Required fields are marked *

To see if you are a human *

This site uses Akismet to reduce spam. Learn how your comment data is processed.