Thanks Michael for the analysis. I used this .ssh/config because tramp
always prompted for the password on a public key connection. I just saw in
the manual that one can force the connection to persist:
(customize-set-variable
'tramp-ssh-controlmaster-options
(concat
"-o ControlPath=/tmp/ssh-ControlPath-%%r@%%h:%%p "
"-o ControlMaster=auto -o ControlPersist=yes"))
would this be the appropriate setting for a gpg key? Is there any
recommended way to use a gpg key with tramp? I don't think that my gpg key
on the token isn't found, because the initial session always works without
problems and also in the bash shell there is no issue using my gpg key as
ssh key replacement.
Thanks again for your useful insights!
Cheers,
Reza
On Wed, Feb 23, 2022 at 1:00 PM Michael Albinus <[email protected]>
wrote:
> Reza Housseini <[email protected]> writes:
>
> > Hello Michael
>
> Hi Reza,
>
> > I try to open a ssh connection to a remote host inside eshell. I'm
> > using a gnupg key on a hardware token as my ssh key:
> >
> > cd /ssh:[email protected]:
> >
> > All works fine until I invoke a command like lsusb, the following
> > error appears:
> >
> > Tramp failed to connect. If this happens repeatedly, try t 'M-x
> > tramp-cleanup-this-connection'
> >
> > The backtrace in [1] was obtained with (setq tramp-verbose 10).
> >
> > My ~/.ssh/config looks like this:
> >
> > Host *
> > IdentityFile /dev/null
> > PasswordAuthentication no
> > PubkeyAuthentication yes
> >
> > Hope you can make out an error on my side.
>
> Thanks for your traces. As you have said, the primary connection works
> w/o pain:
>
> --8<---------------cut here---------------start------------->8---
> 10:40:55.919861 tramp-send-command (6) # exec ssh -l root -e none
> 164.92.254.165
> 10:40:56.745065 tramp-process-actions (6) #
> Last login: Wed Feb 23 08:43:22 2022 from 31.164.127.136
> root@calendar ~#
> --8<---------------cut here---------------end--------------->8---
>
> However, when you call lsusb, a *new* connection is opened in eshell,
> and this fails:
>
> --8<---------------cut here---------------start------------->8---
> 10:44:11.444294 tramp-send-command (6) # exec ssh -l root -e none
> 164.92.254.165
> 10:44:11.584717 tramp-process-actions (6) #
> Load key "/dev/null": invalid format
> [email protected]: Permission denied (publickey,password).
> --8<---------------cut here---------------end--------------->8---
>
> Could it be, that, due to the GPG key, no parallel session is allowed?
> Or that your GPG key on token is not found, and ssh uses the value of
> IdentityFile?
>
> Have you tried to enable tramp-use-ssh-controlmaster-options?
>
> > Thanks and kind regards,
> > Reza
>
> Best regards, Michael.
>