My file server on the internet runs OpenSSH, where users upload and download files using scp or WinSCP. At the same time, the server runs some web applications (http), which need higher priority.

Is there a way to give HTTP priority over SSH file transfer? If not, can I limit SSH bandwidth for incomming connections?

  • 4
    Danger Will Robinson! If you prioritize http over ssh, and your http server becomes saturated, you may not be able to login via ssh. There are settings that could mitigate this, such as letting a connection transfer a certain amount of data before throttling it...but that's getting even more complicated.
    – teeks99
    Jan 26 '11 at 14:01

What you're looking for is called traffic shaping, which can be done (for instance) with wondershaper or trickle. Here is a nice article from linux.com summing up how to use trickle to achieve throttling on a single process or on services via trickled.


SCP/SSH packets normally have a bulk TOS. So i think you should raise the TOS of TCP packets from port 80 using iptables TOS target. Then the standard tc-pfifo-fast priomap will do the right thing.

Play around the following:

iptables -t mangle -A PREROUTING -p tcp --sport 80 -j TOS --set-tos Maximize-Throughput
iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TOS --set-tos Maximize-Throughput

Or actually, may be you should try to tune the QOS on your router and not on your server: change the QOS where the bottleneck is.

  • This worked for me on Ubuntu 18.04 Apr 23 '20 at 18:20

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.