scp 上的破管错误

Broken pipe error on scp

我可以通过 ssh 进入我的 ubuntu 盒子,而且我已经 scp 将我的应用程序版本放到服务器上,但是当我 运行

scp MaryBaked.tar.gz root@marybakedpdx.com:/home/marybakedpdx

甚至

scp MaryBaked.tar.gz root@marybakedpdx.com:~

scp的进度跳到81%,然后进程说stalled然后我得到

rite failed: Broken pipe lost connection

编辑

root@marybakedpdx:/home/marybakedpdx# df -T

Filesystem     Type     1K-blocks    Used Available Use% Mounted on
/dev/vda1      ext4      30830588 2906508  26334944  10% /
none           tmpfs            4       0         4   0% /sys/fs/cgroup
udev           devtmpfs    498088       4    498084   1% /dev
tmpfs          tmpfs       101788     356    101432   1% /run
none           tmpfs         5120       0      5120   0% /run/lock
none           tmpfs       508940       0    508940   0% /run/shm
none           tmpfs       102400       0    102400   0% /run/user

尝试节流 - 2Mb/sec max throughput 像这样:

scp -l 2000 MaryBaked.tar.gz root@marybakedpdx.com:/home/marybakedpdx

scp man page

问题是连接关闭了,可能是文件太大导致会话超时终止

解决方案 1:使用 ServerAliveCountMaxServerAliveCountMax 来回发送来自保持会话的服务器 (acks) 的保持活动消息=23=]ServerAliveInterval 选项

scp -o ServerAliveInterval=15 -o ServerAliveCountMax=3 <yourIP>:~

在此示例中,每 15 秒回头查看 ack,如果 45 秒 (15*3) 内有 3 个 ack 没有返回,则关闭会话。

查看下面的属性文档:

ServerAliveCountMax Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any messages back from the server. If this threshold is reached while server alive messages are being sent, ssh will disconnect from the server, terminating the session. It is important to note that the use of server alive messages is very different from TCPKeepAlive (below). The server alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The server alive mechanism is valuable when the client or server depend on knowing when a connection has become unresponsive. The default value is 3. If, for example, ServerAliveInterval (see below) is set to 15 and ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after approximately 45 seconds.

ServerAliveInterval Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server.

解决方案 2: 我可以建议您一个简单的解决方法:压缩文件,将其发送并解压缩到您的目标机器上。这将缩短连接时间并应该解决超时问题。

gzip bigfile.bin
scp bigfile.bin.gz <destinationIp>:~/
ssh -At <destinationIp>
cd ~
gunzip bigfile.bin.gz

我的 Mac 也遇到了同样的问题,如果我在 SCP 上设置 -l 标志并设置低数据速率,它就会起作用。最终,我禁用了“Jumbo Frames”,这解决了我的问题。

当我复制一个已经在我的本地计算机上打开的文件并且它很忙时发生在我身上。