ssh_askpass missing on osx

I recently installed tower on my system and tried to connect to a git repo I use. I don’t have my default password set in git (I like typing passwords), so when it tried to prompt me, I didn’t have a means of telling Tower what my password was. This is an oversight in OSX, but hey, we can fix that. This is the error I received
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
Permission denied, please try again.

And here’s the language to fix it. Place this code into a file at /usr/libexec/ssh-askpass and make it executable chmod +x /usr/libexec/ssh-askpass and you should be good to go. Tower will prompt you for passwords using a handy dialog.

#! /bin/sh

#
# An SSH_ASKPASS command for MacOS X
#
# Author: Joseph Mocker, Sun Microsystems

#
# To use this script:
# setenv SSH_ASKPASS "macos-askpass"
# setenv DISPLAY ":0"
#

TITLE=${MACOS_ASKPASS_TITLE:-"SSH"}

DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\""
DIALOG="$DIALOG with icon caution with hidden answer"

result=`osascript -e 'tell application "Finder"' -e "activate" -e "$DIALOG" -e 'end tell'`

if [ "$result" = "" ]; then
exit 1
else
echo "$result" | sed -e 's/^text returned://' -e 's/, button returned:.*$//'
exit 0
fi

Leave a Reply

Your email address will not be published. Required fields are marked *