# ClamAV permission problem



## anthony911 (Aug 10, 2009)

Hey guys whats up!
So I decided the upgrade from 6.1 to 7.2 was giving me too much of a hard time so I decided to start everything from scratch. 
So far I have not had any problems with the installation
I did however do something that I know I should not have done.
I issued this command


```
#chown â€“R vscan:vscan /var/db/clamav
#chown â€“R vscan:vscan /var/log/clamav
#chown â€“R vscan:vscan /var/run/clamav
```

and now I get an error saying

```
Starting clamav_clamd
ERROR: Can't open /var/log/clamav/clamd.log in append mode (check permissions!).
ERROR: Cant initialize internal logger
Starting clamav_freshclam
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Probem with Internal logger (UpdateLogFile = /var/log/clamav/freshclam.log)
Waiting for clamd socket....60...50...40...30...20...10...
```
and then it fails


I think I changed some kind of permission but I don't know how to put it back to normal. 

I issued these commands from this url 

```
http://forums.freebsd.org/showthread.php?t=5919
```


```
touch /var/log/clamd.log
chown vscan:vscan /var/log/clamd.log
```


```
mkdir /var/log/clamav
touch /var/log/clamav/clamd.log
chown -R vscan:vscan /var/log/clamav
```

but I still get the error
how do I put it back to normal?


----------



## robertclemens (Aug 10, 2009)

It's fairly hard to guess what the problem is with the information presented not giving the whole picture. However, I would suggest that vscan may not be what clamav is running as.

A lot of setups use different permissions:

```
-rw-r-----  1 clamav  clamav   630K Aug 10 14:32 clamd.log
-rw-r-----  1 clamav  clamav   868K Aug 10 14:22 freshclam.log
```
That is my /var/log/clamav directory. You need to verify the user/group you are running as.

Also you may need to look in your /usr/local/etc/clamd.conf file for:

```
# Run as another user (clamd must be started by root for this option to work)
# Default: don't drop privileges
User clamav
```


----------



## anthony911 (Aug 10, 2009)

i have that line
i have 
User clamav


----------



## DutchDaemon (Aug 10, 2009)

Then repeat those commands with clamav:clamav instead of vscan:vscan ..


----------



## anthony911 (Aug 10, 2009)

I did that...still get the same error


----------



## DutchDaemon (Aug 10, 2009)

Did you also touch and chown /var/log/clamav/freshclam.log?

What output do you get after that?


----------



## anthony911 (Aug 10, 2009)

I did

```
chown -R clamav:clamav /var/log/clamav/clamd.log
touch clamav:clamav /var/log/clamav/clamd.log
chown -R clamav:clamav /var/log/clamav/freshclam.log
touch clamav:clamav /var/log/clamav/freshclam.log
```

and


```
touch clamav:clamav /var/log/clamav/clamd.log
chown -R clamav:clamav /var/log/clamav/clamd.log
touch clamav:clamav /var/log/clamav/freshclam.log
chown -R clamav:clamav /var/log/clamav/freshclam.log
```

all 3 were done on seperate reboot occasions
i also did

```
#chown â€“R vscan:vscan /var/db/clamav
#chown â€“R vscan:vscan /var/log/clamav
#chown â€“R vscan:vscan /var/run/clamav
```

nothing worked.


----------



## DutchDaemon (Aug 10, 2009)

The 'chown -R' command is supposed to be applied to directories (recursive chown), not files. If the directory is not owned by clamav, it cannot create files in it.

Try [cmd=]chown -R clamav:clamav /var/log/clamav /var/db/clamav /var/run/clamav[/cmd]

Forget about the vscan user/group, unless you have it configured somewhere in clamav config files.


----------



## anthony911 (Aug 11, 2009)

I tried that command it does nothing I still get the same error 
the attachment is exactly my error


----------



## DutchDaemon (Aug 11, 2009)

What is the output of:

[cmd=]ls -ld /var/log/clamav
ls -al /var/log/clamav[/cmd] ?


----------

