This repository has been archived by the owner on Nov 23, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6ed0d79
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
# Script: INSTALL | ||
# Author: Mark Carver | ||
# Created: 2011-09-14 | ||
# Copyright (c) 2011 Beyond Eden Development, LLC. All rights reserved. | ||
|
||
if [[ $EUID -ne 0 ]]; then | ||
echo "ERROR: This installation must be run as 'root'. Try using the command \`sudo INSTALL\`." &>/dev/stderr; | ||
exit 1 | ||
else | ||
sshaskpass='/usr/libexec/ssh-askpass'; | ||
if [[ $(cp ./ssh-askpass ${sshaskpass}) -eq 0 ]] && [[ $(chmod +x ${sshaskpass}) -eq 0 ]]; then | ||
echo "Successfully installed '${sshaskpass}'."; | ||
${sshaskpass} "$(printf "Testing ssh-askpass!\n\nNOTE: Test will output to terminal!")"; | ||
exit $?; | ||
else | ||
echo "Failed to install '${sshaskpass}'. Check to make sure you have write abilities for '$(dirname ${sshaskpass}) and then try again." &>/dev/stderr; exit 1; | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ssh-askpass (for Mac OS X) | ||
|
||
Author: Mark Carver | ||
Created: 2011-09-14 | ||
Copyright (c) 2011 Beyond Eden Development, LLC. All rights reserved. | ||
|
||
Based from author: Joseph Mocker, Sun Microsystems | ||
[http://blogs.oracle.com/mock/entry/and\_now\_chicken\_of\_the](http://blogs.oracle.com/mock/entry/and\_now\_chicken\_of\_the) | ||
|
||
--- | ||
|
||
# Usage | ||
Install this script as root | ||
> `sudo ./INSTALL` | ||
# Notes | ||
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"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
# Script: ssh-askpass | ||
# Author: Mark Carver | ||
# Created: 2011-09-14 | ||
# Copyright (c) 2011 Beyond Eden Development, LLC. All rights reserved. | ||
|
||
# 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[*]} "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}"; |