【问题标题】:emacs Tramp on Windows: plink says /bin/sh: env: command not foundWindows 上的 emacs Tramp:plink 说 /bin/sh: env: command not found
【发布时间】:2018-09-14 13:47:41
【问题描述】:

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

而 putty 给了我一个会话。我想通过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*

【问题讨论】:

    标签: windows emacs plink tramp


    【解决方案1】:

    Tramp 期望 "/bin/sh" 作为远程 shell。参见变量tramp-methods,条目“plink”,属性tramp-login-program。您可以更改它(Tramp 手册解释),但无论您选择什么,它都必须是与 POSIX 兼容的 shell。不知道,在 MS Windows 上是否有这样的野兽。

    【讨论】:

    • 我可能很蹩脚,但可以从git for windows sdk 获得的MSYS2 被视为MS Windows 上的POSIX 兼容shell 吗?
    • 也许 MSYS2 shell 冷就足够了。不知道,我自己不使用MS Windows。我确实预计会有更多问题(使用 POSIX 工具、MS Windows 样式路径名与 UNIX 样式路径名等)。你最好试试。
    • 我在 cmd.exe 上试过它只是退出 :( (更新的答案)。我还有一个选项可以在 Windows 10(子shell)上尝试,之后我最终退出并在 VM 中使用 GNU/Linux .
    • 啊等一下,我想我也必须在来宾 Windows 上添加 MSys2。对吗?
    • 当然,我们说的是在远程主机上运行 shell。
    猜你喜欢
    • 2017-01-29
    • 1970-01-01
    • 2020-01-28
    • 2022-12-21
    • 2020-09-26
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    • 2015-09-29
    相关资源
    最近更新 更多