I'm fiddling with
scp on mac and it seems to me like the
-l option doesn't work; though I'm also (perhaps more) open to the idea that I'm just misunderstanding or misusing something. I'm not trying to solve a problem that requires limiting the bandwidth of a transfer so I don't need alternative suggestions, I'm just curious what's going on with my attempt to use this specific option. Looking for dis/confirmation that this is the behaviour other's are seeing and/or an explanation of what's wrong with my attempt.
I made a 10K file then tried to
scp it to
localhost:<file> with a limit of 1Kb/s thinking it should take ~80 seconds but the output of
scp shows a transfer speed higher than 1Kb/s and the command completes effectively immediately.
xy@xyz exploring-scp % man scp | grep -B1 Limits -l limit. Limits the used bandwidth, specified in Kbit/s.
src=$(mktemp) cat /dev/random | head -c 10240 > $src scp -i ~/.ssh/id_rsa -l 1 $src localhost:/tmp/random.bin
My first thought was that maybe it's being "smart" and seeing localhost and skipping the network and therefore skipping with bandwidth limit; but the same thing happens both if I use the explicit IP for localhost, and also if I try to
scp the file from a docker container back to the mac host.
I'm also fairly confident I've used the
-l flag successfully on linux even when copying to/from localhost. (I was fiddling with it a little while ago on linux but it's not convenient right now for me to access a linux machine to try it on).
MacBook Pro (Retina, 13-inch, Early 2015) 2.7 GHz Dual-Core Intel Core i5 8 GB 1867 MHz DDR3 Intel Iris Graphics 6100 1536 MB