Windows上的emacs Tramp:plink说/ bin / sh:env:找不到命令

时间:2018-09-14 13:47:41

标签: windows emacs plink tramp

在Windows上使用emacs Tramp,我试图远程登录Windows PC。它会在以下plink命令失败(在emacs和cmd.exe上)后发出问题

虽然腻子给了我一个会话。我想通过emacs使用它。 我需要做什么才能使其在Windows上的Tramp上运行。

注意:我已经尝试过一个SO答案中提到的字节编译文件tramp-sh.el修复程序。已更新为通过Git MSys2使用Emacs 26.1(可以说是最小的cygwin)。参考更多的答案,但没有找到对目标Windows PC的帮助。感谢任何帮助指针。

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 

更新1:使用MSys2代替/ bin / sh只会退出(预期将使用MSys2启动Shell会话)

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 个答案:

答案 0 :(得分:1)

Tramp希望“ / bin / sh”作为远程外壳程序。参见变量tramp-methods,条目“ plink”,属性tramp-login-program。您可以更改此设置(Tramp手册进行了说明),但是无论您选择什么,它都必须是POSIX兼容的外壳。不知道,MS Windows上是否有这样的野兽。