1
votes

Using emacs Tramp on Windows, I am trying to remotely log in to a windows PC. It issues following plink command which fails (both on emacs and cmd.exe)

While putty gives me a session. I would want to use it via emacs. What do I need to do to make it work on Tramp on Windows.

Note: I have tried the byte-compile-file tramp-sh.el fix as mentioned in one SO answer. updated to using Emacs 26.1 via Git MSys2 (minimal cygwin, we could say). Referred to few more answers and did not find much help for target windows PC. Any help pointer is appreciated.

cmd.exe:

C:\Users\myUser>plink -v -l int***** -ssh -t inpu******* " env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=
#$ ' ssh " && exit | exit
... 
...
Sent password
Access granted
Opening session as main channel
Opened main channel
Allocated pty (ospeed 38400bps, ispeed 38400bps)
Started a shell/command
/bin/sh: env: command not found
Server sent command exit status 0
Disconnected: All channels closed

Emacs:

Tramp: Opening connection for int*****@inpu******* using plink...
Tramp: Sending command ‘plink -l int*****  -ssh -t inpu******* " env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=#$ ' /bin/sh " && exit || exit’
Tramp: Waiting for prompts from remote shell...
Tramp: Sending password
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for int*****@inpu******* using plink...failed 

Update 1: Using MSys2 instead of /bin/sh just exits (expected to start a shell session using MSys2)

Sent password
Access granted
Opening session as main channel
Opened main channel
Allocated pty (ospeed 38400bps, ispeed 38400bps)
Started a shell/command
*exits here*
1

1 Answers

2
votes

Tramp expects "/bin/sh" as remote shell. See variable tramp-methods, entry "plink", attribute tramp-login-program. You could change this (the Tramp manual explains), but whatever you choose, it must be a POSIX compatible shell. No idea, whether there is such a beast on MS Windows.