Short form:

You can limit the bandwidth the scp uses with the -l switch, you pass a number that's in kbits/sec.

I'd rather set this in my .ssh/config file for certain names machines.

What's the equivalent named setting for -l? I haven't been able to find it.

Followup question:

Generally, not sure how to map back and forth between ssh command line options and config names, short of doing Google searches or manually comparing man pages on a case by case basis. Is there a table that directly equates the two?

Longer form of first question, with context:

I've started using ssh config quite a bit, especially now that I need to go through a proxy and do lots of port mappings. I even define the same machine more than once depending on what type of tunneling I need.

However, when uploading a large file, it's difficult to do anything else on my machine. Even though I have more download bandwidth than up, I think that scp saturates the link so even my small requests can't reach the Internet.

There's a fix for this, using the -l bandwidth command line switch for scp.

scp -l 1000 bigfile.zip titan:

I'd like to use this in my config instead, so I'd create an additional named entry called "titan-upload" and I'd use that as the target whenever I upload.

So instead of:

scp bigfile.zip titan:

I'd say:

scp bigfile.zip titan-upload:

Or even set different caps depending on where I am:

scp bigfile.zip titan-upload-from-work:
scp bigfile.zip titan-upload-from-home:

I'm generally on Mac and Linux.

  • AFAIK there simply is no configuration option. It must be set on the command line each time.
    – Zoredache
    Jun 12, 2014 at 22:08
  • FYI: You are suffering from bufferbloat. You can almost entirely fix the big upload destroys interactivity problem if you can use tc on the router. I'm pretty sure the term bufferbloat will help you find pre-made scripts. (I'd find one for you, but I'm on mobile...)
    – derobert
    Jun 13, 2014 at 9:29
  • man ssh_config does show the option IPQoS, which sounds maybe promising, but I don't understand the cryptic flags in the mage page like af11, af12, ... cs0, cs1 ... Google searches are useless, either bringing back endless copies of the man page or else firewall config options not directly related to .ssh/config. But it's interesting, you can set two numbers, one for foreground and one for background. On the Cisco pages I kept finding it said "interactive" vs. "bandwidth". I think the trick is to set QOS for background for NON-interactive and get scp to use that, not sure how. Jul 10, 2014 at 2:49

1 Answer 1


Alas, as was mentioned, there doesn't see to be a config option to limit bandwidth. (I checked source code!)

Some possible solutions are to use an alias for scp, or perhaps a function. Bash is typically the default shell on both mac & linux, so this could work:

alias scp='scp -l 1000 '
alias scp-throttle='scp -l 1000 '

(note trailing space inside quotes!1) This would cause EVERY scp command you use to throttle bandwidth. Considering your situation, perhaps the best solution overall.

The second might be a good choice, since you could use scp for 'normal' transfers, and scp-throttle for slower transfers.

Or a function, with a bit more brains:

function scp { if [ "$*" =~ "-upload" ]; then command scp -l 1000 "$@"; else command scp  "$@"; fi; }

Basically, if we find '-upload' anywhere in the arguments, we perform the transfer with the bw limit, otherwise, a normal transfer occurs.

This would allow you to continue using your multiple names/aliases to denote actions.

  • scp aaa titan: - would upload normally
  • scp aaa titan-upload: - would throttle
  • scp titan:aaa . - normal
  • scp titan-upload-from-home:aaa . - throttled
  • scp a-file-to-upload titan: - oops, throttled, not intentional!


1 - The trailing space INSIDE the alias allows further alias expansion after the aliased command. VERY helpful/useful. Bash Man Page, __ALIASES__ section

  • Thanks all for the comments, and for migrating to the Unix stack, I hadn't noticed it before. A friend of mine had a rationalization for why the -l might not have an equiv in ssh: it's specific to scp, and not something in base ssh, so maybe that's why. Also, in theory, -l 1000 isn't that much more typing than a "-slow" suffix, I just have to remember which number to use depending on where I'm at. The "tc" suggestion for the router sounded interesting, I may go sniff that out the next time I'm dealing with this, though I'm hesitant to change anything on that beast. Jun 16, 2014 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .