Windows 10 has its own ssh.exe
. I can use ssh.exe
fine within eshell
, but not for Tramp, e.g. /ssh:user@host:/tmp
.
Is there any way to enable Tramp with the built-in ssh (OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
)?
I don't use MS Windows. However, people have reported that Tramp's sshx
method works on MS Windows. Something like /sshx:user@host:/tmp
.
However, it seems like you must set tramp-use-ssh-controlmaster-options
to nil
first, newer Tramp versions do it for you on MS Windows.
I can use
ssh.exe
fine withineshell
, but not for Tramp, e.g./ssh:user@host:/tmp
.
Ah, but if you pay attention you will notice that the output in Eshell looks somewhat off:
~/ $ # within eshell
~/ $ ssh user@host
Pseudo-terminal will not be allocated because stdin is not a terminal.
...
Since no "pseudo-terminal" is allocated, the classic PS1 is missing and TRAMP does not detect the prompt. We have to adjust the login arguments.
By default, TRAMP will supply the following arguments to ssh
:
(assoc 'tramp-login-args (assoc "ssh" tramp-methods))
;; => (tramp-login-args
;; (("-l" "%u")
;; ("-p" "%p")
;; ("%c")
;; ("-e" "none")
;; ("%h")))
In order to force the allocation of a pseudo-terminal, we have to supply -tt
as additional argument. I like to use cl-pushnew
for that, but you may use whatever method you like (or even just setf
the place):
(when (eq system-type 'windows-nt)
(require 'cl-lib)
(with-eval-after-load 'tramp
(cl-pushnew '("-tt")
(car (alist-get 'tramp-login-args
(cdr (assoc "ssh" tramp-methods))))
:test #'equal)))
With this, the prompt will be shown and TRAMP can work as expected.