search
top

Fixing missing ssh-askpass on MacOS 10.5

This helps if you have trouble with missing /usr/libexec/ssh-askpass on Leopard. It’s quiet annoying but i found the following shell script and it works perfect for Textmate and probably all other places. This includes not just passwords but also the yes/no for the remote fingerprint question.

#! /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

That’s the original script found on Retep’s Open Source Blog. I’ve reposted the script here because it was poorly formatted (quotes) and there is one thing to change.

Save the above as ssh-askpass:

sudo vi /usr/libexec/ssh-askpass

Paste the script, save the file (needs sudo password), make it executable

sudo chmod +x /usr/libexec/ssh-askpass

The setenv didn’t work on my 10.5.0 install. So instead, i had to use “export”:

export SSH_ASKPASS="macos-askpass"
export DISPLAY=":0"

Now i pushed current branch in textmate and it worked right away. Great! :)
ssh_askpass_screen

3 Responses to “Fixing missing ssh-askpass on MacOS 10.5”

  1. Bjorn says:

    Nice post! This little thing really bugged me a loooong time :). Keep up the nice Cake articles, keeps reminding me that I should share some knowledge, too.

  2. Grant says:

    Thanks! I’m not sure what caused the problem in the first place, but this definitely fixed it.

  3. Peter Mount says:

    Yes, there’s still problems with the formatting in my original article, first with blogger and again when I migrated to wordpress.

    I’m trying to fix the script as shown in the original article as wordpress is forcing the quotes to appear as " :-(

Leave a Reply

top