如何通过 Cygwin 在 Windows 上安装 sshpass?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37243087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:36:02  来源:igfitidea点击:

How to install sshpass on Windows through Cygwin?

windowsbashcygwinsshpass

提问by Oliver Blue

In the packages window of CygWin, when I type sshpass, nothing comes up. I tried installing similar packages like openssh etc hoping one of them contains sshpass but no luck.

在 CygWin 的包窗口中,当我输入 sshpass 时,什么也没有出现。我尝试安装类似的软件包,如 openssh 等,希望其中一个包含 sshpass 但没有运气。

回答by starfry

sshpass is not available as Cygwin package. This means that you need to build and install from source. To build sshpasson Windows (Cygwin):

sshpass 不能作为 Cygwin 包使用。这意味着您需要从源代码构建和安装。在 Windows (Cygwin) 上构建sshpass

$ curl -LO http://downloads.sourceforge.net/sshpass/sshpass-1.06.tar.gz
$ md5sum sshpass-1.06.tar.gz
f59695e3b9761fb51be7d795819421f9

Build and install to /usr/local/bin:

构建并安装到/usr/local/bin

$ tar xvf sshpass-1.06.tar.gz
$ cd sshpass-1.06
$ ./configure
$ make
$ sudo make install

Which installs two files

其中安装两个文件

  • the executable /usr/local/bin/sshpass
  • man page /usr/local/share/man/man1/sshpass.1
  • 可执行文件 /usr/local/bin/sshpass
  • 手册页 /usr/local/share/man/man1/sshpass.1

Your Cygwin install needs to have the required tools: curlto download, tarto extract, and autoconf, makeand gccto build. I'll assume reader familiarity with installing packages on Cygwin.

你的Cygwin的安装需要有所需的工具:curl下载,tar提取,和autoconfmakegcc打造。我假设读者熟悉在 Cygwin 上安装软件包。

回答by matzeri

sshpass is not available as cygwin package. This means that you need to build and install from source. See for reference on existing alternative

sshpass 不能作为 cygwin 包使用。这意味着您需要从源代码构建和安装。有关现有替代方案的参考,请参阅

https://www.cygwin.com/ml/cygwin/2015-02/msg00042.html

https://www.cygwin.com/ml/cygwin/2015-02/msg00042.html

回答by Marko Vranjkovic

This does not directly answer the question "How to install sshpass on Windows?", but can be much easier solution if you need to automatically enter the password when ssh-ing to a machine on Windows system, you can use Plink (part of PuTTY).

这并没有直接回答“如何在 Windows 上安装 sshpass?”的问题,但是如果您在 Windows 系统上 ssh-ing 到机器时需要自动输入密码,则可以更简单的解决方案,您可以使用 Plink(PuTTY 的一部分) )。

plink your_username@yourhost -pw your_password

回答by h--n

Window 10 comes with Linux subsystem, you can install a favor of Linux through Windows Store. Then all Linux commands comes easily. sshpass can be easily installed in the subsystem. WSL(Windwos Subsystem for Linux) is the future.

Window 10 自带Linux 子系统,您可以通过Windows Store 安装Linux 的青睐。然后所有 Linux 命令都可以轻松实现。sshpass 可以很容易地安装在子系统中。WSL(Windwos Linux 子系统)是未来。