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.
4 Answers
sshpass is not available as Cygwin package. This means that you need to build and install from source. To build sshpass on Windows (Cygwin):
$ 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
:
$ 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
Your Cygwin install needs to have the required tools: curl
to download, tar
to extract, and autoconf
, make
and gcc
to build. I'll assume reader familiarity with installing packages on Cygwin.
-
@Andrew do share your experience... I found that I [lost output](https://superuser.com/questions/1193146) when I used `sshpass `from a Windows *Command Prompt*. It works fine from a Cygwin terminal, however. – starfry Mar 31 '17 at 08:19
-
2If you wish to use `sshpass` from a Windows command prompt then [you may find `cygnative` useful](https://superuser.com/a/1199954). – starfry Apr 19 '17 at 16:15
-
1I found that I don't even have `sudo` installed in cygwin, but I was able to get it going without `sudo`.. :) – tplive Feb 19 '19 at 14:31
-
@tplive Can you please elaborate on how you did it? – Palash Dange Apr 17 '20 at 11:52
-
1I see this. http://www.cygwin.com/packages/summary/sshpass.html . I just ran ```C:\p2\cygpacks\setup-x86_64.exe -q -n -N -d -R c:\p2\cygwin64 -l c:\p2\cygpacks\cygwin64localpackages -s http://cygwin.mirror.constant.com -P sshpass ``` . It installed sshpass. – David Gleba Jun 22 '20 at 14:43
sshpass is not available as cygwin package. This means that you need to build and install from source. See for reference on existing alternative

- 8,062
- 2
- 15
- 16
-
Thanks matzeri for reply. How can I build and install on Windows? Could you refer me to some tutorial. – Oliver Blue May 16 '16 at 18:24
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).
plink your_username@yourhost -pw your_password

- 6,481
- 7
- 49
- 68
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.

- 5,903
- 4
- 31
- 32
-
1Sure, but I shouldn't need to start (or set up, if I don't have one) a WSL installation, just to automatically use a password with SSH, if I already have a working SSH client on Windows. – Andrew Koster Mar 17 '20 at 02:33