uncategorized

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

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

Prepare for make

cd sshpass-1.06
./configure

make and install

sudo make install

Command parameters

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