# 1 - Pacchetto mancante?
Probabilmente ti manca il pacchetto che contiene ssh-askpass
. Prova a installarlo.
Fedora / CentOS / RHEL:
$ sudo yum install openssh-askpass
Debian / Ubuntu:
$ sudo apt-get install ssh-askpass-gnome ssh-askpass
Trovare utilità mancanti
Puoi cercare gli strumenti mancanti usando questi comandi:
Fedora / CentOS / RHEL:
$ yum search ssh-askpass
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
======================================================= Matched: ssh-askpass =======================================================
x11-ssh-askpass.x86_64 : A passphrase dialog for X and not only for OpenSSH
ksshaskpass.x86_64 : A KDE version of ssh-askpass with KWallet support
connect-proxy.x86_64 : SSH Proxy command helper
openssh-askpass.x86_64 : A passphrase dialog for OpenSSH and X
Debian / Ubuntu:
$ apt-file -l search ssh-askpass
app-install-data
cruft
git-cola
luckybackup-data
pssh
sdm-terminal
seahorse
ssh-askpass
ssh-askpass-fullscreen
ssh-askpass-gnome
# 2 - Terminale disconnesso?
Inizialmente l'ho perso, ma dopo un'ulteriore lettura ho notato questo commento nella pagina man ssh
riguardante la SSH_ASKPASS
variabile d'ambiente.
estratto
SSH_ASKPASS If ssh needs a passphrase, it will read the passphrase from the
current terminal if it was run from a terminal. If ssh does not
have a terminal associated with it but DISPLAY and SSH_ASKPASS
are set, it will execute the program specified by SSH_ASKPASS
and open an X11 window to read the passphrase. This is particularly
useful when calling ssh from a .xsession or related script.
(Note that on some machines it may be necessary to redirect the
input from /dev/null to make this work.)
Se si nota nel commento, afferma che ssh "non ha un terminale associato" E DISPLAY
& SSH_ASKPASS
sono impostati. Notare che questa è la chiave. Quindi per ssh
poter usare SSH_ASKPASS
dobbiamo ssh
avere un terminale (aka. STDIN
& STDOUT
) Collegato.
Un modo per farlo usando il comando setsid
. Non stare male. Non ho mai sentito parlare di questo strumento. Dalla pagina man:
setsid - esegue un programma in una nuova sessione
Quindi, se corriamo ssh
come "programma" setsid
, possiamo staccarci ssh
dal nostro terminale soddisfacendo i criteri menzionati nella ssh
pagina di manuale. Gli altri criteri sono impostati come segue:
$ echo $DISPLAY; echo $SSH_ASKPASS
:0.0
/usr/libexec/openssh/ssh-askpass
Quindi, se mettiamo tutto insieme:
$ setsid ssh user@remotehost
Per esempio:
$ setsid ssh user@skinner
Una soluzione
Se vuoi farlo in modo che setsid
sia "incorporato" puoi creare un alias in questo modo:
$ alias ssh="setsid ssh"
Ora quando ssh
viene visualizzata la GUI che richiede la password:
$ ssh user@skinner
Riferimenti