Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to implement the classic UpsideDownTernet prank enhancement.

So it basically goes like this:

Only, it's not working. First of all, squid refused to run the Perl script because it wasn't the owner.

So I made squid the owner of the perl script.

Now the images can't be served off the localhost server because they're owned by squid, so the web server doesn't have permission.

I feel like there's something obvious I'm missing. Obviously I could add a new line to the perl script to chmod each image, but nobody else seems to have that problem.

I'm running squid/Apache on OSX by the way.

Replies are listed 'Best First'.
Re: Permissions problem with UpsideDownTernet
by tobyink (Canon) on Feb 13, 2014 at 09:31 UTC

    It's probably squid's umask. A umask is a set of bitflags that strips away file permissions when a new file is created. All processes on Unix inherit a umask from their parent (but may change their umask to whatever they like).

    Squid's default umask is apparently 027, which means that it strips away write access from users within its group, and strips away read/write/execute access from uses outside its group. You can specify a different umask in your squid config.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

      Thanks. That makes a lot of sense.

      However it hasn't worked. I've added that directive but still all the files written by the perl script invoked by squid are unreadable. Even my hacky solution of adding a chmod line to the perl script didn't work. Very frustrating.

      Working with squid Mountain Lion seems to have big problems. It can't even correctly create its own directories in its own cache folder: folders it creates have permission d--------- and it can't write to a folder it created itself.

        Ignore the above: I was doing the umask all wrong. It is working fine now with a umask 022 directive in the .conf file.

        For the record I've got the MacPorts version of squid 2.7 (2.7.STABLE9 for i686-apple-darwin12.5.0) and XAMPP Apache (XAMPP for OS X 1.8.3-2) working just fine together on OS X 10.8.5 a.k. Mountain Lion.