You should first file a complaint with the server's administration, observing that public key authentication is vastly more secure than simply a password, but I'll assume you've already done so, and your admins are simply idiots.
Apple sadly removed ssh-askpass when they integrated its functionality into ssh, scp, and ssh-add. There is however an SSHKeychain package that provides an ssh-askpass with an Apple-like Cocoa password prompt for macports' openssh package. It should fix your problems the way you want, perhaps even setting the SSH_ASKPASS variable for you.
Just fyi, I'd usually recommend against installing the openssh macports package itself because it break your Apple password prompt, but once you've installed SSHKeychain macports usually offers a more recent openssh than Apple.
There is nothing wrong imho with embedding passwords in scripts when the server disables public key authentication, i.e. if they cared about security, they should reenable public keys. There are even servers that intentionally break sshpass. You could access such machines using the following expect script :
#!/usr/bin/expect -f
set timeout -1
set send_human {.05 0.1 1 .07 1.5}
eval spawn $argv
match_max 100000
expect {
-re "USERNAME@(\[0-9A-Za-z_\\-\\.\]+)'s password: "
{ sleep 0.1 ; send -- "PASSWORD\r" ; sleep 0.3 }
}
interact
You may speed up this script by reducing the sleeps and send_human delays.
Your PATH variable got contaminated by some irregular file content: either your git file in /etc/paths.d/, /etc/profile or ~/.MacOSX/environment.plist or all three are corrupted.
Use shiftcmdG in Finder to jump to each of the folders and check the content of them.
/etc/paths.d/ should contain a file git with the content /usr/local/git/bin
. If you have installed other apps like X11 there may be additional files in paths.d - all containing paths.
The file profile in /etc/ should contain at least
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
The file environment.plist should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin</string>
</dict>
</plist>
The PATH string may contain other paths as well. The file may contain other keys - depending on other installs you have made previously.
If you have found irregular content in one of the files simply replace it with the content shown above. You have to be an admin to modify the first two files because they are root:wheel realm. If you use TextEdit or another text editor to modify them, be sure to save them as plain text and without file extension (i.e. .txt). You can ignore a missing ~/.MacOSX/environment.plist because it isn't supported in your environment (system version) anymore, besides you use some hacks.
Best Answer
You will need to use
sudo cp
instead of justcp
to copy a file to/usr/local/bin
because/usr/*
is only writable for root.