Hi, this is a reply to bug 749019 and bug 881811, which stem from the same
problem in the vnstat Debian package:

 - /lib/systemd/system/vnstat.service defines User=vnstat as the user to
run run vnstat under
 - The recommended way to start tracking a network interface and create its
database file is: sudo vnstat -u -i ethX. This creates a db file owned by
root:root, mode 0644.
 - Hence the vnstatd process cannot write to this file, and the db is never
updated.

The solution to this is to either chown -R vnstat:vnstat /var/lib/vnstat,
or use sudo -u vnstat when creating the db. But all this requires manual
intervention that is not documented anywhere.

Ideally it would be automated or documented.

We had a discussion on IRC on how to best fix this. At first there was an
attempt to use DaemonUser "vnstat" DaemonGroup "vnstat" and removing
User=vnstat from the systemd unit file. But even then you have to systemctl
restart vnstat for it to fix the db file permissions. So also manual.

I think a good and simple fix is to install the /var/lib/vnstat/ directory
with sgid bit set. That way any file created there would have correct
permissions.

This bug prevents vnstat from working completly if the user doesn't do
their research. So I would be happy for it to be fixed.

Dear maintainer, please let us know how you'd prefer this to be fixed.

Thanks

Reply via email to