Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Monday, March 5, 2012

Qt Creator On Mac, Asking For Password

Qt Creator may ask for a password, if automatic login is not configured for the version control system. The Linux utility for this task is usually ssh-askpass, but it does not exist on the Mac.

Here is an alternative, originating from Joseph Mocker:


#! /bin/sh
# An SSH_ASKPASS command for MacOS X, with minor modifications to macos-askpass
# by Joseph Mocker, Sun Microsystems.
#
# To use this script:
#     setenv SSH_ASKPASS "ssh-askpass-mac"


TITLE="Enter SSH Password"  
DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\""
DIALOG="$DIALOG with icon 1 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

Save it to /usr/local/bin/ssh-askpass-mac, and let Qt Creator know where to find: PreferencesVersion ControlSSH prompt command.