scp出现stalled的原因和解决方法


When transferring large files(for example mksysb images) usingscp through a firewall, the scp connection stalls.

Cause:

The reason for scp to stall, is because scp greedily grabs asmuch bandwith of the network as possible when it transfers files,any delay caused by the network switch of the firewall can easilymake the TCP connection stalled.

Solution:

There’s a solution to this problem: Add “-l 8192″ to the scpcommand.

Adding the option “-l 8192″ limits the scp session bandwith upto 8192 Kbit/second, which seems to work safe and fast enough (upto 1 MB/second):


  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
scp是在Linux系统中用于安全地在本地计算机和远程计算机之间复制文件或目录的命令。下面是scp的一些常见用法和场景: 1. 从本地复制文件到远程主机: ``` scp file.txt username@hostname:/path/to/destination ``` 这将将本地的file.txt文件复制到远程主机上的指定路径。需要替换`file.txt`为您要复制的本地文件路径,`username`为您的用户名,`hostname`为目标主机的IP地址或域名,`/path/to/destination`为目标主机上的目标路径。 2. 从远程主机复制文件到本地: ``` scp username@hostname:/path/to/file.txt /local/path/to/destination ``` 这将从远程主机上的指定路径复制file.txt文件到本地计算机的指定路径。需要替换`username`为远程主机的用户名,`hostname`为远程主机的IP地址或域名,`/path/to/file.txt`为远程主机上的文件路径,`/local/path/to/destination`为本地计算机上的目标路径。 3. 递归复制目录: ``` scp -r directory username@hostname:/path/to/destination ``` 这将递归地复制本地目录到远程主机上的指定路径。需要替换`directory`为您要复制的本地目录的路径。 4. 指定端口号: ``` scp -P port file.txt username@hostname:/path/to/destination ``` 这将通过指定的端口号连接到远程主机进行文件复制。需要替换`port`为远程主机的端口号。 5. 使用SSH密钥: ``` scp -i private_key.pem file.txt username@hostname:/path/to/destination ``` 这将使用指定的SSH密钥进行身份验证,并将file.txt文件复制到远程主机上的指定路径。需要替换`private_key.pem`为您的私钥文件路径。 这些只是scp的一部分用法和场景,更多详细的使用方法和选项可以通过man scp命令查看scp的手册页面。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值