简体   繁体   English

使用ssh config在emacs中进行Tramp模式

[英]Tramp mode in emacs using ssh config

I think this is very basic question in using tramp, but it doesn't work for me. 我认为这是使用tramp的一个非常基本的问题,但它对我不起作用。 I have my ~/.ssh/config file that points to my amazon ec2 machine 我的〜/ .ssh / config文件指向我的amazon ec2机器

Host amazon
   Hostname xxxx.amazonaws.com
   Port yyy
   User me
   IdentityFile ~/.ssh/ubuntu
   ForwardAgent yes

I can easily do ssh amazon from my terminal and I go to amazon ec2 (so my config is right), but in emacs I do: 我可以从我的终端轻松地做ssh amazon,然后我去亚马逊ec2(所以我的配置是正确的),但在emacs我做:

C-x C-f /ssh1:amazon:

I always get this error In Aquamacs: 我总是在Aquamacs中得到这个错误:

Process *tramp/ssh1 amz* exited abnormally with code 255

In Emacs: 在Emacs中:

tramp: Opening connection at amz using ssh1...
tramp: Waiting for prompts from remote shell
tramp: Waiting 60s for prompt from remote shell
tramp-process-actions: Login failed

I also have other ssh configurations that they ssh to my virtual boxes on my local machine and they have the same problem. 我还有其他ssh配置,他们ssh到我的本地机器上的虚拟盒子,他们有同样的问题。

I really appreciate any help. 我非常感谢任何帮助。

One thing that's worth trying is using the sshx connection method. 值得尝试的一件事是使用sshx连接方法。 That makes tramp try to avoid any non-standard shell configuration on the remote host. 这使得tramp尝试避免远程主机上的任何非标准shell配置。

Like this: 像这样:

C-x C-f /sshx:amazon:

The tramp method ssh1 forces ssh to be run in ssh v1 protocol mode with the parameter -1 . tramp方法ssh1强制ssh在ssh v1协议模式下运行,参数为-1 ssh v1 has known weaknesses and is insecure. ssh v1已知缺点并且不安全。 Hence a lot of sites disable the ssh v1 protocol. 因此很多站点都禁用了ssh v1协议。

You can verify this from the shell with ssh -1 me@xxxx.amazonaws.com . 您可以使用ssh -1 me@xxxx.amazonaws.com从shell验证这ssh -1 me@xxxx.amazonaws.com

Try other tramp connection methods like ssh , sftp or scpx . 尝试其他tramp连接方法,如sshsftpscpx You can see all pre-configured connection methods with Ch v tramp-methods . 您可以使用Ch v tramp-methods查看所有预配置的连接Ch v tramp-methods

If Moritz Bunkus's answer doesn't solve the issue, then you can configure the verbosity of tramp's output with 如果Moritz Bunkus的答案没有解决问题,那么你可以配置tramp输出的详细程度
Mx customize-variable RET tramp-verbose RET Mx customize-variable RET tramp-verbose RET

In particular, level 6 is "sent and received strings" which might help you to determine whether the "Waiting for prompts from remote shell" is because it isn't receiving a prompt pattern that it recognises, or because of some more critical failure. 特别是,级别6是“发送和接收的字符串”,可以帮助您确定“等待来自远程shell的提示”是因为它没有收到它识别的提示模式,还是因为某些更严重的故障。

If it's simply receiving a prompt it doesn't recognise, then you might look at customizing the tramp-login-prompt-regexp or tramp-shell-prompt-pattern variables. 如果它只是接收到它无法识别的提示,那么您可能会查看自定义tramp-login-prompt-regexptramp-shell-prompt-pattern变量。

(Of course if your ssh agent is working correctly, then login prompts shouldn't be relevant.) (当然,如果你的ssh代理工作正常,那么登录提示应该不相关。)

If you're running Emacs in Windows, then also see these Q&As: 如果您在Windows中运行Emacs,那么还要看这些问答:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM