Monitor bandwidth usage per user in linux

3

I have "chrooted" my users in my Ubuntu Server and I need to monitor their bandwidth usage. Since they can access to a FTP, a SSH and a website runned by a chrooted PHP-FPM, I need to monitor all these usages too.

I've took a look at ntop, vnStat, bmon and some others, but they all seems to monitor bandwidth by their interfaces. Is there any way to measure those informations on a user based?

Danny Coulombe

Posted 2013-05-25T16:06:46.163

Reputation:

Answers

2

The iptables owner module can mark packets based on UID. Then you could use some backend like ulogd to log their size and then process the log and compute totals. However, it can handle only locally generated packets, which means you'll be able to count just outgoing data, not incoming one as well.

AnonymousLurker

Posted 2013-05-25T16:06:46.163

Reputation: 775