I keep running into this. For various reasons I need to use password-based authentication on some test boxes that are regularly rebuilt which makes using key based authentication difficult.
Ordinarily I set up an alias like this:
alias ssh1="sshpass -p secretpassword ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
… which lets me use a command like:
sshl eric@devbox
But sometimes (and I swear, it doesn’t always happen, but I haven’t figured out the variable yet), it fails, and I get:
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
… and indeed, the ssh-askpass binary doesn’t exist. After some flailing around and googling, I finally came up with this ugly hack. I create a shell script with the following contents:
#!/bin/bash echo "secretpassword"
Then, I set the following environment variable, which directs sshpass to use my script instead of looking for the missing ssh-askpass
export SSH_ASKPASS=/Users/eric/scripts/ssh-askpass.sh
It’s ugly, but it works. Of course, it assumes you’re always using the same “secretpassword”. Some day I need to figure out a better way of addressing this, but today is not that day.
See also: http://apple.stackexchange.com/questions/18238/mac-os-x-lion-and-sshpass