Recently I've noticed that logrotate does not rotate my logs.

user1@host:~$ /usr/sbin/logrotate /home/user1/logrotate.conf -v gives me an error:

error: error setting owner of /home/logs/mylog.log.1 to uid 10111 and gid 10111: Operation not permitted error: error creating output file /var/lib/logrotate/status.tmp: Permission denied

That gid confuses me, as user1 is only a member of a group with different gid:

user1@host:~$ id uid=10111(user1) gid=1001(mygroup) groups=1001(mygroup)

However, there's another group called user1, but, as I mentioned, actual user user1 is not its member:

user1@host:~$ cat /etc/group | grep user1 user1:x:10111

It's something simple here, but I can't see it.

UPDATE: here's what logrotate.conf looks like:

/home/logs/*.log { rotate 7 daily copytruncate compress notifempty }

logrotate 3.8.7


user1@host:~$ ls -la /home/logs/ -rw-r--r-- 1 user1 mygroup 1358383344 Dec 19 00:58 mylog.log

  • Can you add the corresponding stanza of your logrotate.conf? (Oh,and also your version of logrotate, just in case.) – Ulrich Schwarz Dec 18 '15 at 5:27
  • @UlrichSchwarz just updated the question, thanks. – hdf Dec 18 '15 at 5:36
  • 1
    Please add the output of ls -l /home/user1/*.log – wurtel Dec 18 '15 at 7:50
  • @wurtel nothing suspicious there, just updated. thanks. – hdf Dec 19 '15 at 1:05
  • Why is it trying to set group to 10111 if the log file itself is in group 1001(mygroup); that's what you need to find out. – wurtel Dec 21 '15 at 12:16

Try with a different user, one having default group membership: for each user userx there is membership in a distinct userx group. If logrotate is successful with different user account, then apply similar group membership settings for the user1 account having difficulty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.