I have a logfile owner by the 'apache' user that I would like to rotate with logrotate.
I would like to do that by running logrotate as a different user, say 'web' using the copytruncate strategy.
That fails with this error:
error: error setting owner of ./logfile.log.1: Operation not permitted
But only because logrotate tries to change the owner of the new file to the owner of the rotated file, ie apache. But I dont care about the new files having the same owner, if logrotate would create copies with 'web' as owner that would be fine and then it could work fine.
So is there any way to stop logrotate from changing the owner of the copied file?
Best Answer
I use the
create
directive in my/etc/logrotate.d/
files. Example: