Skip to content Skip to sidebar Skip to footer

Logrotate Error Because Parent Directory has Insecure Permissions

I'm currently tidying up the existing logs where I take the original logs and rotate them to any folder I want, but there was a problem when I tried to manually simulate this simulation would be applied before the system automatically ran it.

Issue

When I command the command run logrotate :

# /usr/sbin/logrotate -f -v -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf

It raises an error that makes the logrotate not work as expected

# error: skipping "/usr/local/zend/var/log/access.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
because parent directory has insecure permissions
because parent directory has insecure permissions

Cause

As seen above the error output is clear because of "Permissions" and we have been advised to "Set su" or add privileges to the configuration we made earlier :

# cat /etc/logrotate.d/zend
/usr/local/zend/var/log/*.log {
    olddir /apps/data/KitsakeLog/daily/zend
        daily
        rotate 7
    missingok
    lastaction
        /etc/logrotate.d/scripts/zend-ownership.sh
    endscript
}

Resolution

And here I try to enter "su root root" in the zend log configuration :

# vi /etc/logrotate.d/zend
/usr/local/zend/var/log/*.log {
    su root root
    olddir /apps/data/KitsakeLog/daily/zend
        daily
        rotate 7
    missingok
    lastaction
        /etc/logrotate.d/scripts/zend-ownership.sh
    endscript
}

Trying

And now try the simulation again by manual hit to logrotate :

# /usr/sbin/logrotate -f -v -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
trying simulate after configured
trying simulate after configured

In the following image is the result of a correctly executed logrotate, which conforms to the parameters we configured in the previously set up configuration file.

result of logrotate zend
result of logrotate zend

Yup, that's my experience when encountering the 'Error Because Parent Directory has Insecure Permissions' while setting up logrotate on my Linux RHEL 7 server. I hope my experience can serve as a reference for you if you encounter the same issue.

Maybe that's all I can share with you guys. Hopefully, this article will be helpful.

Thank you.

Bangkit Ade Saputra
Bangkit Ade Saputra At the end of the day, my job involves people. we're complicated, we're always changing, we have millions of things going on in our lives, and changing jobs is always a big decision.

Post a Comment for "Logrotate Error Because Parent Directory has Insecure Permissions"