lukas-zronek / ssh-askpass-mac

A macOS front-end of ssh-askpass with keychain support
BSD 2-Clause "Simplified" License
19 stars 2 forks source link

sign_and_send_pubkey: signing failed: agent refused operation #3

Closed torarnv closed 1 year ago

torarnv commented 4 years ago

After following the configuration instructions, and adding a key to the agent with -c, connecting to a server gives sign_and_send_pubkey: signing failed: agent refused operation.

Running launchctl print gui/$(id -u)/com.openssh.ssh-agent doesn't show any of the environment variables (DISPLAY and SSH_ASKPASS). Is stopping the agent using launchctlenough? Will it pick up those environment variables that were just set?

lukas-zronek commented 4 years ago

Hello,

which operating system version and which shell do you use? Please send the content of .bash_profile and .zprofile (if you use zsh) then I can take a closer look at it.

It should look like this:

cat ~/.bash_profile

ssh_askpass_mac=/Applications/ssh-askpass.app/Contents/MacOS/ssh-askpass export SSH_ASKPASS=$ssh_askpass_mac if [ -z ${DISPLAY+x} ] then export DISPLAY= launchctl setenv DISPLAY "" fi ssh_askpass_env=$(launchctl getenv SSH_ASKPASS) if [ "$ssh_askpass_env" != "$ssh_askpass_mac" ] then launchctl setenv SSH_ASKPASS "$ssh_askpass_mac" && launchctl stop com.openssh.ssh-agent fi ssh-add() { command ssh-add $@ < /dev/null }

If you use zsh the ~/.bash_profile must be imported from zsh:

cat ~/.zprofile

[[ -e ~/.bash_profile ]] && emulate sh -c 'source ~/.bash_profile'

launchctl print gui/$(id -u)/com.openssh.ssh-agent

inherited environment = { SSH_ASKPASS => /Applications/ssh-askpass.app/Contents/MacOS/ssh-askpass DISPLAY => SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.XXXXXXXX/Listeners }

lukas-zronek commented 1 year ago

I'm closing old tickets. If the problem persists, please test the latest version and create a new ticket.