Note: this project has been deprecated in favor of the brew package: https://github.com/theseal/ssh-askpass
brew tap theseal/ssh-askpass
brew install ssh-askpassAuthor: Mark Carver
Created: 2011-09-14
Licensed under GPL 3.0
Based off script from author: Joseph Mocker, Sun Microsystems http://blogs.oracle.com/mock/entry/and_now_chicken_of_the
If you've gotten this error:
remote: ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
Then you probably need this script. Mac OS X does not prompt for a password outside of Terminal when connecting via SSH (for security reasons). This script grants any application the ability to prompt the user for a password via an AppleScript dialog.
- You can install this script using the
INSTALLfile included with the download (easiest/automatic)
- Open Terminal
/Applications/Utilities/Terminal.app- Type
sudo``(with the space at the end)- Drag the
INSTALLfile ontoTerminaland pressreturn- Enter your password
- You can install this script manually:
- Copy the source code located below
- Open Terminal
/Applications/Utilities/Terminal.app- Type
sudo vi /usr/libexec/ssh-askpass- Enter your password
- Type
ito go into edit mode- Press
⌘vto paste the code- Press
escto go out of edit mode- Type
:thenwand pressreturnto write the file- Type
:thenxand pressreturnto exit vi- Type
sudo chmod +rx /usr/libexec/ssh-askpassto make the script executable- Test the script! Type
/usr/libexec/ssh-askpassNOTE: You must run as
rootor precede the commands withsudowhen usingINSTALLorvi. The directory/usr/libexecis owned byroot.
If you plan on manually installing this script, please note that you will have to set the following variable for SSH to recognize where the script is located:
export SSH_ASKPASS="/path/to/ssh-askpass"
#!/bin/bash
# Script: ssh-askpass
# Author: Mark Carver
# Created: 2011-09-14
# Licensed under GPL 3.0
# A ssh-askpass command for Mac OS X
# Based from author: Joseph Mocker, Sun Microsystems
# http://blogs.oracle.com/mock/entry/and_now_chicken_of_the
# To use this script:
# Install this script running INSTALL as root
#
# If you plan on manually installing this script, please note that you will have
# to set the following variable for SSH to recognize where the script is located:
# export SSH_ASKPASS="/path/to/ssh-askpass"
TITLE="${SSH_ASKPASS_TITLE:-SSH}";
TEXT="$(whoami)'s password:";
IFS=$(printf "\n");
CODE=("on GetCurrentApp()");
CODE=(${CODE[*]} "tell application \"System Events\" to get short name of first process whose frontmost is true");
CODE=(${CODE[*]} "end GetCurrentApp");
CODE=(${CODE[*]} "tell application GetCurrentApp()");
CODE=(${CODE[*]} "activate");
CODE=(${CODE[*]} "display dialog \"${@:-$TEXT}\" default answer \"\" with title \"${TITLE}\" with icon caution with hidden answer");
CODE=(${CODE[*]} "text returned of result");
CODE=(${CODE[*]} "end tell");
SCRIPT="/usr/bin/osascript"
for LINE in ${CODE[*]}; do
SCRIPT="${SCRIPT} -e $(printf "%q" "${LINE}")";
done;
eval "${SCRIPT}";