fix(syslog): add logrotate 'su root adm' directive#87
Merged
Conversation
/var/log is owned root:adm (group-writable), which causes logrotate to skip all log files in that directory with: error: skipping "/var/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. Fix by inserting 'su root adm' into /etc/logrotate.conf before the include /etc/logrotate.d line, and into /etc/logrotate-dmesg.conf before the /var/log/dmesg stanza, during syslog configure. This tells logrotate to run as root:adm, which has the necessary permissions to safely rotate files under /var/log. Also add verify checks that the directive is present in both files. Signed-off-by: Mark Silva <mark.silva@emerson.com>
amstewart
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
/var/log is owned root:adm (group-writable), which causes logrotate to skip all log files in that directory with:
error: skipping "/var/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.
Fix by inserting 'su root adm' into /etc/logrotate.conf before the include /etc/logrotate.d line, and into /etc/logrotate-dmesg.conf before the /var/log/dmesg stanza, during syslog configure. This tells logrotate to run as root:adm, which has the necessary permissions to safely rotate files under /var/log.
Also add verify checks that the directive is present in both files.
Justification
AB#3698573
Testing
Verified that there is no message at boot and that
logrotate --forcehas no errorsProcedure