知道为什么我会得到这个。我可以从本地计算机成功 ping 服务器。哪个 sshpass 显示有效输出,我正在使用 Cygwin64。
$ sshpass -p loriK0ba scp SSUA-HG.war SSUA-RCd.war loki12:/tmp/ARUNKS
lost connection
要安装 sshpass,我按照以下步骤操作,-V 显示有效输出:
# IMPORTANT: You need to have sshpass utility installed on your local machine.
# ============================================================================
# HOW to get sshpass:
# STEPS: Run the following commands in Cygwin console window - This is a one time action.
# a. cd /cygdrive/c
# b. wget http://downloads.sourceforge.net/project/sshpass/sshpass/1.05/sshpass-1.05.tar.gz
# c. tar -xvzpf sshpass-1.05.tar.gz
# d. cd sshpass-1.05
# e. sh configure
# f. make install
# g. which sshpass
# ============================================================================
.
sh configure; sleep 5; make install; sleep 5; which sshpass
sshpass 的版本是:
$ sshpass -V
sshpass 1.05 (C) 2006-2011 Lingnu Open Source Consulting Ltd.
This program is free software, and can be distributed under the terms of the GPL
See the COPYING file for more information.
PS:当我使用以下命令运行 sshpass 时,它不会出错,但也不会在目标服务器上创建 giga.txt 文件(因此它没有达到/做任何事情)。本地机器(运行 Cygwin 的地方)和目标机器上都存在相同的用户(区分大小写)。
sshpass -p loriK0ba ssh -q loki12 'rm -rf /tmp/ARUNKS/* 2>/dev/null; mkdir /tmp/ARUNKS 2>/dev/null'