Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

logrotate not rotating: skipping "..." because parent directory has insecure permissions, and other reasons

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When logrotate prints skipping "/var/log/app/app.log" because parent directory has insecure permissions, it has refused to rotate that log because the directory holding it is writable by others, or by a group that is not root. The fix is either to tell logrotate which user and group to use with an su directive, or to correct the directory permissions. A log that logrotate skips keeps growing, so the disk can fill.

What the error means

In the logrotate 3.22.0 source, the check runs for each log before rotation. It applies only when the log's stanza has no su directive and logrotate is running as root. It then looks at the log's parent directory. The log is skipped if the directory's group is not root and the group-write bit is set, or if the world-write bit is set. The comment in the source reads: "Don't rotate in directories writable by others or group which is not "root"".

The full message in that source is:

skipping "%s" 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.

The %s is the log file's path. The message is raised at error level, so it is not silent: logrotate prints it. Where you see it depends on how logrotate is started. The logrotate manual says it is normally run as a daily cron job, or by logrotate.timer when using systemd. A cron run mails or logs the output as cron does. For a timer run, expect the output in the journal of the service the timer starts (the manual names the unit logrotate.service but does not say where a timer run's output goes), so step 1 below reads that journal.

This is a safety rule. The manual's description of su says that if logrotate runs with root privileges, using su is recommended "to rotate files in directories that are directly or indirectly in control of non-privileged users".

Likely causes

Cause What you see How to confirm
Parent directory writable by a non-root group or by everyone, no su directive The "insecure permissions" message for that log ls -ld on the directory; look for w in the group or other columns
No su directive and the directory is owned by an application account Same message stat shows a non-root group on the directory
Rotation criteria not met (size, age, empty log) No message; debug mode says the log does not need rotating logrotate -d on the config file
Config file ignored (writable by group or others, or wrong owner) Ignoring ... because it is writable by group or others. or ... because the file owner is wrong (should be root or user with uid 0). ls -l on the config file
Log path does not match (wildcard or a path that does not exist) Debug output says the log does not exist Compare the path in the stanza with the file
Logrotate not running at all No rotation anywhere, no recent log systemctl list-timers and the cron entries

Prove the cause before changing anything

All of these are read-only. Debug mode is documented as making no changes.

1. See the message. If logrotate runs from systemd, read the service's journal:

journalctl -u logrotate.service --since "2026-11-18 00:00:00"

logrotate.service is the unit name that the manual's description of ProtectSystem=full refers to. The journalctl page documents -u and --since, and says date specifications should be of the format "2012-10-30 18:17:16". If cron runs it, read the mail or log the job produces.

2. Run logrotate in debug mode on the main config file, which reads every stanza it includes.

logrotate -d /etc/logrotate.conf

The manual says -d, --debug turns on debug mode, "which means that no changes are made to the logs and the logrotate state file is not updated. Only debug messages are printed." In the source, each log produces a line starting considering log, and a log that does not need rotating produces a line starting log does not need rotating with a reason in brackets, for example (log size is below the 'size' threshold) or (log is empty). Config files are announced as reading config file.

3. Check the directory.

ls -ld /var/log/app
stat -c '%A %U %G %n' /var/log/app

The ls page documents -d (list the directory itself) and -l. The stat page documents -c with the format characters %A (permission bits in readable form), %U (user name of owner), %G (group name of owner) and %n (file name). The rule above matches in either of two cases: a w in the other (world) part of the permission string, or a w in the group part when the directory's group is not root.

4. Check the config file. In the source, when logrotate runs as root it ignores a config file writable by group or others, or not owned by root. The manual says of the include directive: "For security reasons configuration files must not be group-writable nor world-writable."

5. Check the schedule. The manual says logrotate "will not modify a log more than once in one day unless the criterion for that log is based on the log's size and logrotate is being run more than once each day, or unless the -f or --force option is used." systemctl list-timers lists timers.

Fix

Save first

Copy the config file that holds the stanza under a dated name:

cp /etc/logrotate.d/app /root/app-logrotate-saved-20261120

Record the directory's current state with the stat line above, and keep the output. Keep the saved copy outside the logrotate include directory so it is not read as a second config.

Add an su directive (the manual's recommendation)

Disruptive step: adding an su line makes the stanza rotate as the named user, so a wrong user or group can make rotation fail or leave the new log file with the wrong owner, which can stop the application writing.

Edit the stanza and add a line such as su app app, where the two names are the user and group that own the log directory. The manual says the su directive tells logrotate to "Rotate log files set under this user and group instead of using default user/group (usually root)", and that if the user and group do not have enough privilege to create files with the ownership named in a create directive, "it will cause an error". Check that create and su agree.

Test with debug mode before the next real run:

logrotate -d /etc/logrotate.conf

To back out, restore the saved file with cp /root/app-logrotate-saved-20261120 /etc/logrotate.d/app, then run the debug command above again to check the configuration.

Or tighten the directory

Risk: removing group-write and world-write from the directory may break an application that relies on that write access to create new log files. Record the mode first with the stat line, and make the change only when you know which accounts must write there. Remove group-write and world-write from the directory, for example with chmod g-w,o-w /var/log/app. To back out, restore the permission bits you recorded, for example chmod g+w,o+w /var/log/app only if both bits were set before (use chmod g+w /var/log/app if only the group bit was set). The chmod page documents symbolic modes of this form.

Do not run logrotate -f to test the fix. The manual describes -f as forcing rotation, and the rotate count setting decides how many rotated files are kept before the oldest is removed, so a forced run can delete old logs across every stanza it reads. Let the next scheduled run do the rotation.

Example (illustrative): On web01, an application writes to /var/log/app/app.log and the directory is owned by app:app with mode drwxrwxr-x. The disk is filling and app.log is large. Debug mode shows the "insecure permissions" message for that log. The stanza has no su line. Adding su app app and running debug again shows considering log /var/log/app/app.log and no skip message. The next scheduled run rotates the log.

Confirm the fix

  1. The debug run no longer prints the skip message for that log.
  2. After the next scheduled run, ls -l /var/log/app shows a rotated file and a fresh log.
  3. The application keeps writing to the new log file (check its modification time).
  4. The state file named in the manual as /var/lib/logrotate.status reflects the rotation.

What to watch afterwards

  • Alert on any logrotate error message, not only on disk space.
  • Re-check directory permissions after application updates or restores, since they can reset modes.
  • Watch the size of the largest logs; a skipped rotation shows first as one file that keeps growing.
  • Keep the su line in your configuration management so a rebuild does not lose it.

Risks and limits

  • These commands have not been run or lab-tested.
  • Message text is from the 3.22.0 source. Other versions can differ.
  • The check applies only when logrotate runs as root without su. A non-root run follows different paths that are not covered.
  • The manual page is from the logrotate project repository; distributions may patch behaviour.

Sources

  • logrotate 3.22.0 source: logrotate.c — logrotate project, tag 3.22.0, no date shown, accessed 20 November 2026
  • logrotate 3.22.0 source: config.c — logrotate project, tag 3.22.0, no date shown, accessed 20 November 2026
  • logrotate changelog — logrotate project, lists 3.22.0 released 2024-06-01, accessed 20 November 2026
  • logrotate(8) — logrotate project manual page on man7.org, footer version 3.22.0.37_73ae, colophon: most recent upstream commit 2026-06-01, accessed 20 November 2026
  • journalctl(1) — systemd 262~devel (development manual), colophon: obtained 2026-08-04, most recent upstream commit 2026-08-03, accessed 20 November 2026
  • systemctl — systemd 262 documentation, no date shown, accessed 20 November 2026
  • ls(1) — GNU coreutils 9.11, April 2026, accessed 20 November 2026
  • stat(1) — GNU coreutils 9.11, April 2026, accessed 20 November 2026
  • chmod(1) — GNU coreutils 9.11, April 2026, accessed 20 November 2026
  • cp(1) — GNU coreutils 9.11, April 2026, accessed 20 November 2026