1

I installed Squid3 on Rasbian, and did some minor configuration. Then I set it up to cache to an auto mounting usb drive.

I was looking over the logs and found only TCP_MISS. I was hoping after a little bit of using Squid with the I'd see some hits. I looked in the cache (the ufs tree is there) and it appears to be caching files.

I ran squid -X -d9 and got errors that the log files could not be written:

FATAL: Cannot open '/var/log/squid3/access.log' for writing.
The parent directory must be writeable by the
user 'proxy', which is the cache_effective_user
set in squid.conf.
Squid Cache (Version 3.1.20): Terminated abnormally.

the permissions for /var/log/squid3 are:

drwxrwxr-x  2 proxy proxy   4096 Apr 29 14:13 squid3

and inside:

-rwxrwx--- 1 proxy proxy      0 Apr 29 06:25 access.log
-rwxrwx--- 1 proxy proxy 303469 Apr 28 23:41 access.log.1
-rwxrwxrwx 1 proxy proxy  14730 Apr 29 14:47 cache.log
-rwxrwx--- 1 proxy proxy  79626 Apr 28 22:00 cache.log.1
-rwxrwx--- 1 root  root       0 Apr 27 14:09 store.log.1

Permissions for the cache mounted at /cache0

drwxrwxr-x  19 root proxy  4096 Apr 29 14:47 cache0

How can I resolve these errors? Thank you in advance.

1
  • Hi Jason. Server Fault is for professional system administrators with problems in the workplace. I'll assume you're not using that Raspberry Pi at work, so your question is fine to stay here.
    – slhck
    Apr 30, 2013 at 10:31

2 Answers 2

3

The default squid user proxy needs write permission from the parent to all the directories it writes to; including the cache directory (cache_dir) and log files.

I didn't want to change the permissions of /var or /var/log, so I created a new directory /squid3_logs and set the log locations in squid.conf.

access_log /squid3_logs/access.log squid
cache_store_log /squid3_logs/store.log
cache_log /squid3_logs/cache.log

I also made sure that all the files and subdirectories in my cache (/cache0) had the proper permissions. When I ran the debug command squid -X -d9 as my user, I think automatically changed the swap.state owner to me.

sudo chown proxy:proxy /cache0/swap.state
sudo chmod -R 775 /cache0

Now everything seems to be working. I'm not finding any errors when I run the debug command, or when I parse the config file (squid3 -k parse).

0

First change owner to proxy and then add user in squid.conf as given below sudo chown proxy:proxy /usr/local/squid -R

for permission error, you just set cache_effective_user in squid.conf and restart squid. /usr/local/squid/etc/squid.conf

cache_effective_user proxy

This config resolved my issue

1
  • Answered 4 years ago.
    – Sacha K
    Oct 25, 2017 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .