FATAL: Failed to make swap directory /var/cache/squid: (13) Permission Denied

5,898

I can't comment, so I'll try to answer. squid runs as the user "proxy" now; see the line cache_effective_user in squid.conf. Why they keep changing this, I have no idea.

But wait! Don't edit squid.conf. Don't ever. Create a squid.conf.special file or some other name and "include" it in squid.conf. You do not want to search through the 7,800+ lines of squid.conf to make changes.

I am having the same issue as you, ABC. I regret that I cannot give you a definitive answer because I haven't solved it yet.

Edit: I deleted the cache directory, which on my machine was /var/spool/squid. I reinstalled squid, and recreated the cache directory. That did no good. Looking at the cache directory, it still had the time and date of the original installation. This made me suspicious and I deleted it again. I created a new directory, /var/spool/squid3 and told squid to use that by editing my /etc/squid/squid.conf.forward file, and making sure that it was "included" in squid.conf.

I made sure that /var/spool/squid3 was readable and writable by squid:

sudo chown -R proxy:proxy /var/spool/squid3 

sudo chmod -R 775 /var/spool/squid3

Then after stopping squid,

sudo service squid stop

creating the cache with

sudo squid -z

(this time I saw all the cache directories being created)

and restarting squid

sudo service squid start

it worked. Edit: But poorly. Something is still wrong. The proxy serves pages that I've never been to, but not google or the other ones I use regularly.

11-14-2019 Edit: I ended up installing ClearOS firewall, which has a simpler squid.conf file, and does other functions by default that you have to enable with Ubuntu. (The only thing I really had to change was opening port 53 to get time from the internet and use the firewall as a time server.) Installing squid and creating the cache worked perfectly.

Share:
5,898

Related videos on Youtube

ABC
Author by

ABC

Updated on September 18, 2022

Comments

  • ABC
    ABC over 1 year

    I have successfully installed and configured Squid Proxy Server 3.5.26 in Slackware 14.2. Im currently logged in as root user and I get an error when starting Squid using the command sudo squid -z:

    WARNING: Cannot write log file: /var/log/squid/cache.log
    /var/log/squid/cache.clog: Permission Denied
    messages will be sent to 'stderr'
    
    2019/04/08  16:16:20 kid1| Set Current Directory to 
    /var/log/squid/cache/squid
    2019/04/08  16:16:20 kid1| Creating missing swap directories
    
    FATAL: Failed to make swap directory /var/cache/squid: (13) Permission Denied
    Squid Cache (Version  3.5.26): Terminated abnormally.
    CPU Usage: 0.008 seconds = 0.006 user + 0.002 sys
    Maximum Resident Size: 45392 KB
    Page faults with physical i/o:0 
    
    • mtak
      mtak about 5 years
      Does the directory /var/log/squid exist? What user is squid trying to run as, and does that user have write permissions for this directory?
    • ABC
      ABC about 5 years
      @mtak -> yes var/log/squid exist. the owner of /var/log/squid is squid and the group owner is squid. the permissions are 777.