Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can track http traffic usage by parsing apache logs but is there any way to track ssh traffic usage per uses basis?

share|improve this question
May I ask what is the benefit of this? Usually, SSH traffic is not huge unless you are copying large files over SSH. – Khaled May 31 '12 at 12:52
@Khaled: Things like nervously often run rsync over ssh can quickly consume lots of bandwidth. – Janne Pikkarainen May 31 '12 at 13:02
up vote 1 down vote accepted

I would use iptables owner module (perhaps together with other quota/reporting modules).

iptables -A OUTPUT -p tcp --dport 22 -m owner --uid someuser -j ACCEPT

And then see the output from iptables -vL to see the amount of packets/bytes passed through this rule, or parse the iptables statistics with some analyzer.

share|improve this answer
Thank you. I'll try this. – ayshe May 31 '12 at 13:10

None, there is no way to track SSH bandwidth usage per user, not on the server, and not externally.

share|improve this answer
thank you for your answer @Sirch. how control panels like cpanel measure the ssh traffic usage? – ayshe May 31 '12 at 12:59
Do what Janne said, pipe it through something else that monitors the process by port and owner. – Sirch May 31 '12 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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