# Running Clamd as Amavis

## gohmdoree

I been running clamd as amavis.  All directories have the correct permissions for the user/group.

When the logs are turned, I always get the following back:

```

ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).

```

in /etc/clamd.conf, it states the following:

```

# Run as another user (clamd must be started by root for this option to work)

# Default: don't drop privileges

#User clamav

User amavis

```

My fix is to manually restart clamd.  

I assume the way I have it is having the user amavis restart clamd?  Clarification?  Fix?

----------

## digrouz

If you change manully the permissions to get read/write access to the user amavis to

```
/var/log/clamav
```

and

```
/var/log/clamav/*
```

----------

## gohmdoree

the file ownership for everything within /var/log/clamav or as you put /var/log/clamav/* is 640 with user:group as amavis:amavis.

/var/log/clamav is 755 with user:group as amavis:amavis

----------

## digrouz

in the file 

```
/etc/freshclam.conf
```

did had changed the users clamav to amavis? like for 

```

# By default when started freshclam drops privileges and switches to the

# "clamav" user. This directive allows you to change the database owner.

# Default: clamav (may depend on installation options)

DatabaseOwner clamav

# Initialize supplementary group access (freshclam must be started by root).

# Default: no

AllowSupplementaryGroups yes

```

----------

## gohmdoree

i have the following in my /etc/freshclam.conf

```

# By default when started freshclam drops privileges and switches to the

# "clamav" user. This directive allows you to change the database owner.

# Default: clamav (may depend on installation options)

#DatabaseOwner clamav

DatabaseOwner amavis

# Initialize supplementary group access (freshclam must be started by root).

# Default: no

AllowSupplementaryGroups yes

```

----------

## gohmdoree

any other thoughts here?

----------

## Chris W

There's no need to run clamd as amavis, and it's easier not to bother trying.   From the amavisd .conf file: 

```
### http://www.clamav.net/

['ClamAV-clamd',

  \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],

  qr/\bOK$/, qr/\bFOUND$/,

  qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

# NOTE: run clamd under the same user as amavisd, or run it under its own

#   uid such as clamav, add user clamav to the amavis group, and then add

#   AllowSupplementaryGroups to clamd.conf;

# NOTE: match socket name (LocalSocket) in clamav.conf to the socket name in

#   this entry; when running chrooted one may prefer socket "$MYHOME/clamd".

```

Just a quick: 

```
usermod -a -G clamav amavis
```

 and edit of clamd.conf and you're done.

----------

## gohmdoree

thanks for the tip chris.  will give it a go.

----------

## gohmdoree

i think what that is supposed to be is usermod -a -G amavis clamav, adding clamav to the amavis group.

thats what i did and will give it a go.

----------

## Chris W

Indeed, wrong way round.

----------

