ssh-askpass keyboard grab problems

Jim Knoble jmknoble at pobox.com
Wed Jul 23 15:33:32 EST 2003


Circa 2003-07-22 22:15:45 -0400 dixit John A. Sullivan III:

: I changed SSH_ASKPASS to x11-ssh-askpass.  I could not use a simple X
: session as when I call the application from the command line, it prompts
: for the password on the command line rather than calling SSH_ASKPASS.

In order to convince ssh to use the SSH_ASKPASS program to prompt for a
password or passphrase, the following conditions must be met:

  (1) DISPLAY must be set (to a valid X display, obviously)
  (2) There must be no controlling terminal

See the list archives about this:

  http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=104706638008113&w=2

I really think you should try to reproduce this without any KDE or
other desktop environment in order to tell whether it's KDE or your
application that's grabbing the keyboard.

: I launched it from the KDE desktop running only my application.  The
: password prompt appears but it is immediately covered by an empty
: dialog box.  If I move the empty dialog box and login quickly, all i
: fine (except that if I take the intuitive step of pressing <ENTER>
: to enter my password rather than click on OK, it tells me that I
: used the wrong password - or at least it appears to). If I do not
: move quickly enough, I receive the following errors on stderr:
: 
: x11-ssh-askpass[1981]: Trying to grab keyboard ...
: x11-ssh-askpass[1981]: Could not grab keyboard (someone else already has
: it)
: Permission denied, please try again.
: x11-ssh-askpass[1982]: Trying to grab keyboard ...
: x11-ssh-askpass[1982]: Could not grab keyboard (someone else already has
: it)
: Permission denied, please try again.

Some other application is definitely grabbing the keyboard before
x11-ssh-askpass can get it.  It also looks as if somebody (your app?
ssh?) started two instances of x11-ssh-askpass (the number in square
brackets is the PID)---i can't tell whether it was sequentially or in
parallel.

By default, x11-ssh-askpass tries to grab once per second for 5
seconds.  This may be changed in the source code.  The "empty" dialog
appears because x11-ssh-askpass attempts to grab the keyboard before
allowing passphrase entry, to prevent eavesdropping.

: Pardon my ignorance of rpm but I wasn't quite sure how to find the
: version.  The nearest I could come was checking the change log through
: rpm and that reflects version 1.2.4.1.

Good.  That's the most recent version; no keyboard/mouse/server
grabbing bugs that i'm aware of in that version.

You might try fiddling with the following X resources (usually in your
"${HOME}/.Xdefaults" file; might need to use xrdb(1) to reload them) to
see what happens:

  SshAskpass*grabKeyboard:  (true|false, defaults to true)
  SshAskpass*grabPointer:   (true|false, defaults to false)
  SshAskpass*grabServer:    (true|false, defaults to false)

For an explanation of the available resources, see the
x11-ssh-askpass(1) man page.  If you didn't get such a man page in your
openssh package, complain to Red Hat, then download the x11-ssh-askpass
source:

  http://www.pobox.com/~jmknoble/software/x11-ssh-askpass/

Also, the XGrabKeyboard(3) man page indicates the following:

  The X server automatically performs an UngrabKeyboard request if the
  event window for an active keyboard grab becomes not viewable.
  
You might try hiding (miniaturizing/iconifying, shading) your
application's window while x11-ssh-askpass is trying to grab the
keyboard to see if that lets things work....

Good luck.

-- 
jim knoble  |  jmknoble at pobox.com  |  http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)
"We have guided missiles and misguided men." --Martin Luther King, Jr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 256 bytes
Desc: not available
Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20030723/d7fbfe09/attachment.bin 


More information about the openssh-unix-dev mailing list