Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

Installing on OS X is tricky, since there is no official build for it. Before you get started, you need install xcode and command line tools.

Installing with Homebrew

Homebrew does not allow you to install sshpass by default. But you can use the following unofficial brew package for that.

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

Installing from the Source

  • Download the Source Code
  • Extract it and cd into the directory
  • ./configure
  • sudo make install
@adaptabi

This comment has been minimized.

Show comment
Hide comment
@adaptabi

adaptabi Mar 20, 2015

brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
fails

$ brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
######################################################################## 100.0%
==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpa
Already downloaded: /Library/Caches/Homebrew/sshpass-1.05.tar.gz
Warning: MD5 support is deprecated and will be removed in a future version.
Please switch this formula to SHA1 or SHA256.
Error: MD5 mismatch
Expected: c52d65fdee0712af6f77eb2b60974ac7
Actual: 687fc45d732e5c45b5830e63f647e978
Archive: /Library/Caches/Homebrew/sshpass-1.05.tar.gz
To retry an incomplete download, remove the file above.

brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
fails

$ brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
######################################################################## 100.0%
==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpa
Already downloaded: /Library/Caches/Homebrew/sshpass-1.05.tar.gz
Warning: MD5 support is deprecated and will be removed in a future version.
Please switch this formula to SHA1 or SHA256.
Error: MD5 mismatch
Expected: c52d65fdee0712af6f77eb2b60974ac7
Actual: 687fc45d732e5c45b5830e63f647e978
Archive: /Library/Caches/Homebrew/sshpass-1.05.tar.gz
To retry an incomplete download, remove the file above.
@victorbstan

This comment has been minimized.

Show comment
Hide comment
@victorbstan

victorbstan Mar 25, 2015

brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/ss

################################################################## 100.0%

==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz

################################################################## 100.0%

Warning: MD5 support is deprecated and will be removed in a future version.
Please switch this formula to SHA1 or SHA256.

brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/ss

################################################################## 100.0%

==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz

################################################################## 100.0%

Warning: MD5 support is deprecated and will be removed in a future version.
Please switch this formula to SHA1 or SHA256.

@kadwanev

This comment has been minimized.

Show comment
Hide comment
@arunoda

This comment has been minimized.

Show comment
Hide comment
@arunoda

arunoda May 5, 2015

Thanks @kadwanev
Updated.

Owner

arunoda commented May 5, 2015

Thanks @kadwanev
Updated.

@tawanda

This comment has been minimized.

Show comment
Hide comment
@tawanda

tawanda Sep 18, 2015

Thanks mate

tawanda commented Sep 18, 2015

Thanks mate

@gil-andre

This comment has been minimized.

Show comment
Hide comment
@gil-andre

gil-andre Jan 28, 2016

On Mac OS X "El Capitan" (version 10.11.3 15D21), sshpass can be compiled with "./configure ; make ; sudo make install" provided xcode and command-line tools are installed first.

On Mac OS X "El Capitan" (version 10.11.3 15D21), sshpass can be compiled with "./configure ; make ; sudo make install" provided xcode and command-line tools are installed first.

@neuwirthe

This comment has been minimized.

Show comment
Hide comment
@neuwirthe

neuwirthe Apr 19, 2016

brew create https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz --force

will create a formula which you then can use normally as

brew install sshpass

brew create https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz --force

will create a formula which you then can use normally as

brew install sshpass

@qunwang6

This comment has been minimized.

Show comment
Hide comment
@qunwang6

qunwang6 Aug 31, 2016

how to build for ios?

how to build for ios?

@judge2020

This comment has been minimized.

Show comment
Hide comment
@judge2020

judge2020 Sep 5, 2016

@qunwang6 considering you install both terminal and command-line utilities for iOS, "./configure ; make ; sudo make install" should work since iOS is still unix-based.

@qunwang6 considering you install both terminal and command-line utilities for iOS, "./configure ; make ; sudo make install" should work since iOS is still unix-based.

@sparkmuse

This comment has been minimized.

Show comment
Hide comment
@sparkmuse

sparkmuse Sep 14, 2016

How can I uninstall if I installed it using the source code ?

How can I uninstall if I installed it using the source code ?

@lukesUbuntu

This comment has been minimized.

Show comment
Hide comment
@lukesUbuntu

lukesUbuntu Sep 20, 2016

Just use brew
$brew install http://git.io/sshpass.rb

Just use brew
$brew install http://git.io/sshpass.rb

@bostondevin

This comment has been minimized.

Show comment
Hide comment
@bostondevin

bostondevin May 11, 2017

yum install sshpass worked for me

yum install sshpass worked for me

@chusiang

This comment has been minimized.

Show comment
Hide comment
@chusiang

chusiang Jun 16, 2017

Thank you, it's working on macOS 10.11 for Ansible 2.3.1.

ansible-tw/AMA#21

Thank you, it's working on macOS 10.11 for Ansible 2.3.1.

ansible-tw/AMA#21

@sfblaauw

This comment has been minimized.

Show comment
Hide comment
@sfblaauw

sfblaauw Jun 24, 2017

@lukesUbuntu works form me! Thanks

@lukesUbuntu works form me! Thanks

@FranciscoGutierrez

This comment has been minimized.

Show comment
Hide comment
@FranciscoGutierrez

FranciscoGutierrez Feb 8, 2018

does this work zshell?

does this work zshell?

@johannesjo

This comment has been minimized.

Show comment
Hide comment
@johannesjo

johannesjo Feb 25, 2018

I get the following error:

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz
==> Downloading from https://sourceforge.net/#!/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz
Error: SHA256 mismatch
Expected: c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60
Actual: 7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf
Archive: /Users/travis/Library/Caches/Homebrew/sshpass-1.06.tar.gz
To retry an incomplete download, remove the file above.

I get the following error:

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz
==> Downloading from https://sourceforge.net/#!/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz
Error: SHA256 mismatch
Expected: c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60
Actual: 7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf
Archive: /Users/travis/Library/Caches/Homebrew/sshpass-1.06.tar.gz
To retry an incomplete download, remove the file above.
@maximtatar

This comment has been minimized.

Show comment
Hide comment
@maximtatar

maximtatar Mar 1, 2018

johannesjo, same here on my mac. So I went another suggested above road:
Installing from the Source
Worked as a charm, took < 2min

johannesjo, same here on my mac. So I went another suggested above road:
Installing from the Source
Worked as a charm, took < 2min

@zinndesign

This comment has been minimized.

Show comment
Hide comment
@zinndesign

zinndesign Mar 1, 2018

FYI, I got the same SHA256 error, and it turned out that the SourceForge URL was the issue. If you hit the URL directly:
https://sourceforge.net/#!/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz

You get an error page reading "The sourceforge.net website is temporarily in static offline mode." Hence the SHA256 mismatch, since it's downloading an HTML page instead of a tarball. This also explained why the install worked fine for me on one Mac yesterday, but failed on another today. (I'm also finding multiple other installs via Homebrew are failing today, probably all due to the SourceForge outage. SourceForge confirmed.)

I found an alternative URL that worked and updated the sshpass.rb script to point to it:
url 'https://fossies.org/linux/privat/sshpass-1.06.tar.gz'

Installed without issue after saving the updated Ruby script to my server and running the brew install command pointing to that URL.

zinndesign commented Mar 1, 2018

FYI, I got the same SHA256 error, and it turned out that the SourceForge URL was the issue. If you hit the URL directly:
https://sourceforge.net/#!/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz

You get an error page reading "The sourceforge.net website is temporarily in static offline mode." Hence the SHA256 mismatch, since it's downloading an HTML page instead of a tarball. This also explained why the install worked fine for me on one Mac yesterday, but failed on another today. (I'm also finding multiple other installs via Homebrew are failing today, probably all due to the SourceForge outage. SourceForge confirmed.)

I found an alternative URL that worked and updated the sshpass.rb script to point to it:
url 'https://fossies.org/linux/privat/sshpass-1.06.tar.gz'

Installed without issue after saving the updated Ruby script to my server and running the brew install command pointing to that URL.

@pawarvijay

pawarvijay commented Mar 13, 2018

@zh-f

This comment has been minimized.

Show comment
Hide comment
@zh-f

zh-f Apr 16, 2018

@lukesUbuntu It really helps! Thanks!

zh-f commented Apr 16, 2018

@lukesUbuntu It really helps! Thanks!

@Evgeniy-Odesskiy

This comment has been minimized.

Show comment
Hide comment
@Evgeniy-Odesskiy

Evgeniy-Odesskiy May 10, 2018

@lukesUbuntu works form me! Thanks!

@lukesUbuntu works form me! Thanks!

@shizhongping

This comment has been minimized.

Show comment
Hide comment
@shizhongping

shizhongping Jun 8, 2018

@lukesUbuntu Thanks, saved my time.

@lukesUbuntu Thanks, saved my time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment