Permissions On Nginx Logs

Home » CentOS » Permissions On Nginx Logs
CentOS 7 Comments

Hi folks.

Just wondering if I can change the ownership on the nginx logs folder so I can access them easier for analysis on a regular basis and cronjobs.

/var/log/nginx is owned by nginx:nginx which shuts me out.

Cheers, Bee

7 thoughts on - Permissions On Nginx Logs

  • Add group nginx to your user… usermod -G nginx,… username
    (Where …. Is any other groups you’re a member of, not counting your primary group)

  • Just did that, and I still can’t do this:

    $ cd /var/log/nginx

    -bash: cd: /var/log/nginx: Permission denied

    Cheers, Bee

  • What’s the access mode of it? Should probably be mode 770 then.

    Regards, Simon

  • I will give 770 a try. Nobody going to flip now that a single “7” has been posted?

    Cheers, Bee

  • Thanks to correct me, both things are true, if he only wants to read logs there, the 750 is sufficient of course.

    Regards, Simon

  • Yeah I was still having some issues so I set a cron to rsync the directory out to another directory that I rsync to another machine to, where I do the analysis.

    As per the “7” comment, I always listen to good advice, but usually that advice gets completely derailed with someone saying “nobody should ever be root…”, etc. Best stated, “some people never let their kids play outside”. I have a neighbour like that.

    So all is working, but under testing.

    Cheers, Bee

  • Your CentOS box is nowhere near as well-defended as an unattended human child. The child has millions of years of evolution providing it with an active self-improving immune system, a mammal’s agility, and an apex predator’s cunning.

    If you want a human analogue to a CentOS box, it’s closer to a premature baby in a neonatal intensive care unit. It requires constant inputs from the caregivers and strict adherence to basic guidance like “Don’t open all the doors leading outside at once” to keep these cared-for creations alive.