I have problem connecting via ssh using Tramp in Emacs on MS-Windows whenever the private ssh key I use is configured with a passphrase.
Here's the problem :
I. What works :
- On the command line
ssh -i path/to/shh_key_WITH_NO_passphrase login@hostname
, works just fine and I'm connected to remote server. - On the command line
ssh -i path/to/shh_key_WITH_passphrase login@hostname
, I've got a prompt asking for my passphrase for this key :
And then I'm connected to the remote server.
- In Emacs :
C-x C-f RET /sshx: RET ssh_key_WITH_NO_passphrase
, the connection succeed and I'm able to go through files and open them :
II. What don't works :
- In Emacs :
C-x C-f RET /sshx: RET ssh_key_WITH_passphrase
What happens with previous point 1. :
I get a Opening connection nil for ssh_key_WITH_passphrase using ssh...
and it just hang there and I have to hit C-g
like continously to get it out of there :
III. How to reproduce the bug :
- Get GNU Emacs 28.2 running on MS-Windows 10
- Create two ssh key to connect to a remote server, one with a passphrase and one without, see gitlab's help page for that.
- Set
tramp-default-method
to "ssh" or "sshx" (either don't work on my side) with for exampleM-: RET (setq tramp-default-method "sshx")
- Try to connect with one of the 2 keys, the one with a passphrase should not work, for that I've configure a
config
file in the.ssh/
in which I describe how OpenSSH should connect with remote server :
Host Co_No_Phrase
HostName hostname
Port 22
User login
IdentityFile HOME/.ssh/id_rsa
IdentitiesOnly yes
Host Co_Phrase
HostName hostname
Port 22
User login
IdentityFile HOME/.ssh/id_rsa_phrase
IdentitiesOnly yes
Then :
_ C-x C-f RET /sshx: RET Co_No_Phrase
should tell Emacs to use Tramp to connect to hostname with the key that has no passphrase.
_ C-x C-f RET /sshx: RET Co_Phrase
should tell Emacs to use Tramp to connect to hostname with the key that has a passphrase.
I love using Emacs for coding remotly on clusters, and never had any problem when I was on Linux, but for professionnal reasons I have to be on Windows now, poor me... It's awful, pls help me ?
Thanks a lot to the community
C-x C- RET /sshx::
. Furthermore, it is hard to debug with this informatiion. I don't understand what you mean withssh_key_WITH_NO_passphrase
- I'm not aware of Emacs/Tramp asking for an ssh key.