Blog

Install Sshpass on OSX

.

Ever needed to run ssh commands from a non-interactive shell, and not being able to use keys? Well sshpass is what you need!

I use it for running ssh commands from Automator scripts on OSX. It is quite similar in function to Putty’s Pageant handling of keys.

Pre-reqs:

Please not that Xcode is required to compile as we download the source, which works on most *nix systems.

Download the source files

1
curl -O -L http://downloads.sourceforge.net/project/sshpass/sshpass/1.06/sshpass-1.06.tar.gz && tar xvzf sshpass-1.06.tar.gz
sshpass_download_extract.png

Prepare for make

1
2
cd sshpass-1.06
./configure
configure_source_sshpass.png

make and install

1
sudo make install
sudo_make_install.png

Command parameters

1
2
3
4
5
6
7
8
9
10
11
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information