High accounts-daemon CPU usage for frequent logins
I'm using lsyncd to sync /home between servers. Due to UsePAM yes
in sshd_config, this is causing very frequent "root SSH connection logins", where wtmp is updated. So my wtmp grows in size, it's around 100 MB while the largest I've seen is 765 MB before it got rotated. Judging by the output of last | wc -l
, it seems that every 100 MB of wtmp size correspond to about 120.000 logins.
Anyway, I think that accounts-daemon might be trying to re-parse the whole wtmp file very frequently, because it's use of CPU is high; for example it needs about one CPU hour for 5 days of uptime.
Would it be possible to lower the CPU usage?
A mitigation was to rotate wtmp more frequently, to keep its size smaller:
sed 's/monthly/daily/' -i /etc/logrotate.d/wtmp