Why does scp get stalled? How do I resolve it?

有时候从服务器上传输大文件到本地,会遇到 scp 莫名其妙停止,显示 stalled

When transferring large files using scp through a firewall, the scp connection stalls.


This happens because scp is trying to grab as much bandwidth as possible, and any delay (by a firewall, etc.) can stall it. Limiting the bandwidth (with -l option) will fix it.

发生这种情况是因为scp试图获取尽可能多的带宽,并且任何延迟(通过防火墙等)都可以阻止它。 限制带宽(使用-l选项)可以修复它。

For example, you might want to limit the bandwidth to 1 MB/s (= 8192 Kbits/s):

scp -l 8192 <file> <destination>