Emacs Tramp ssh 失败

Emacs Tramp ssh fails

我正在尝试通过 emacs tramp 连接到远程服务器,如果我通过终端连接一切正常,但 tramp 一直给我同样的错误:

Tramp: Sending command ‘exec ssh -l user -p port -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none hostname’
Tramp: Waiting for prompts from remote shell...
Tramp: Sending password
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for user@hostname#port using ssh...failed
tramp-file-name-handler: Timeout reached, see buffer ‘*tramp/ssh user@hostname*’ for details

我确实尝试检查了提到的缓冲区,但它对我来说只是谜语:

[zplug] These repos have failed to load:
[01;31m- [31mmodules/terminal[00m
- [31mmodules/editor[00m
- [31mmodules/utility[00m
- [31mmodules/spectrum[00m
- [31mmodules/completion[00m
- [31mmodules/fasd[00m
[00m]0;(dali) ~
[1m[33msyj[39m[0m[38;5;242m@[1m[36mdali[39m[0m [1m[31m/home/user[39m[0m [32m[39m [36m[39m[37m[39m[33m[39m                                                            [34m[39m
[0m[27m[24m[J[1m[32m[39m[0m [K

如果有人能给我指出一些资源来帮助我破译这个或指出这里到底出了什么问题,我将非常感激!

编辑:

好吧,现在我真的很难弄清楚这里出了什么问题。远程主机 shell 提示有一点 flashi 格式,我根据 yassinphilips 评论 (Emacs: Tramp doesn't work) 修复了相应的 bashrc,但是 tramp 仍然无法通过 emacs 连接。 当我在我的终端中输入 tramp 命令时,连接不再有效,但在某些时候它确实有效。如果我通过执行 ssh -p Port user@hostname 的终端连接,我的连接没有问题。

调试缓冲区的输出如下

21:43:59.406221 tramp-get-file-property (8) #  file-truename nil
21:43:59.406327 tramp-flush-directory-property (8) # 
21:43:59.406447 tramp-get-connection-property (7) # process-name nil
21:43:59.406558 tramp-flush-connection-property (7) # [ssh syj 147.46.219.160#7919 nil nil] nil
21:43:59.406696 tramp-get-connection-property (7) # process-buffer nil
21:44:08.833748 tramp-get-connection-property (7) # ~ undef
21:44:08.833950 tramp-get-connection-property (7) # process-name nil
21:44:08.834070 tramp-get-connection-property (7) # process-name nil
21:44:08.834175 tramp-get-connection-property (7) # process-buffer nil
21:44:08.835576 tramp-maybe-open-connection (3) # Opening connection for syj@147.46.219.160#7910 using ssh...
21:44:08.836280 tramp-get-connection-property (7) # login-args undef
21:44:08.836365 tramp-get-connection-property (7) # login-args undef
21:44:08.836446 tramp-get-connection-property (7) # process-name nil
21:44:08.836510 tramp-get-connection-property (7) # process-buffer nil
21:44:08.843233 tramp-set-connection-property (7) # vector [ssh syj 147.46.219.160#7910 amelie/ nil]
21:44:08.843407 tramp-maybe-open-connection (6) # /bin/sh -i
21:44:08.843484 tramp-get-connection-property (7) # vector [ssh syj 147.46.219.160#7910 amelie/ nil]
21:44:08.843571 tramp-get-connection-property (7) # check-remote-echo nil
21:44:08.843639 tramp-get-connection-property (7) # check-remote-echo nil
21:44:08.843766 tramp-get-connection-property (7) # gateway nil
21:44:08.847349 tramp-accept-process-output (10) # *tramp/ssh syj@147.46.219.160* run *tramp/ssh syj@147.46.219.160*
#$ 
21:44:08.847477 tramp-get-connection-property (7) # check-remote-echo nil
21:44:08.847558 tramp-get-connection-property (7) # check-remote-echo nil
21:44:08.847636 tramp-wait-for-regexp (6) # 
#$ 
21:44:08.847725 tramp-get-connection-property (7) # login-program undef
21:44:08.847799 tramp-get-connection-property (7) # login-args undef
21:44:08.847872 tramp-get-connection-property (7) # login-env undef
21:44:08.847936 tramp-get-connection-property (7) # async-args undef
21:44:08.847998 tramp-get-connection-property (7) # connection-timeout undef
21:44:08.848061 tramp-get-connection-property (7) # gw-args undef
21:44:08.848183 tramp-get-connection-property (7) # temp-file undef
21:44:08.848477 tramp-set-connection-property (7) # temp-file /var/folders/xn/pzns78lj6hd6qm2zgt96ph680000gp/T/tramp.369406KK
21:44:08.866100 tramp-maybe-open-connection (3) # Sending command ‘exec ssh -l syj -p 7910 -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none 147.46.219.160’
21:44:08.866275 tramp-get-connection-property (7) # process-name nil
21:44:08.866409 tramp-get-connection-property (7) # remote-echo nil
21:44:08.866516 tramp-send-command (6) # exec ssh -l syj -p 7910 -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none 147.46.219.160
21:44:08.866584 tramp-get-connection-property (7) # process-name nil
21:44:08.866649 tramp-get-connection-property (7) # chunksize nil
21:44:08.866713 tramp-set-connection-property (7) # last-cmd-time (22836 152 866694 0)
21:44:08.866783 tramp-send-string (10) # exec ssh -l syj -p 7910 -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none 147.46.219.160
21:44:08.866862 tramp-get-connection-property (7) # process-buffer nil
21:44:08.867009 tramp-set-connection-property (7) # first-password-request t
21:44:08.867691 tramp-process-actions (3) # Waiting for prompts from remote shell...
21:44:08.868230 tramp-get-connection-property (7) # gateway nil
21:44:09.042319 tramp-accept-process-output (10) # *tramp/ssh syj@147.46.219.160* run *tramp/ssh syj@147.46.219.160*
syj@147.46.219.160's password: 
21:44:09.042415 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
21:44:09.042477 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.042535 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.042644 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*:? *\)\'" from remote shell
21:44:09.042717 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.042769 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.042852 tramp-process-one-action (5) # Call ‘tramp-action-password’
21:44:09.042916 tramp-get-connection-property (7) # first-password-request nil
21:44:09.042981 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.043033 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.043617 tramp-action-password (3) # Sending password
21:44:09.043700 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.043757 tramp-get-connection-property (7) # check-remote-echo nil
21:44:09.043860 tramp-get-connection-property (7) # first-password-request t
21:44:11.774611 tramp-set-connection-property (7) # first-password-request nil
21:44:11.774843 tramp-process-one-action (5) # Looking for regexp "\(^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host key verification failed\.\|Login \(?:[Ii]ncorrect\)\|N\(?:ame or service not known\|o supported authentication methods left to try!\)\|Permission denied\|\(?:Sorry, try again\|Timeout, server not responding\)\.\).*\|^.*\(Received signal [0-9]+\).*\)\'" from remote shell
21:44:11.774973 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.775075 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.775204 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
21:44:11.775312 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.775406 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.775521 tramp-process-one-action (5) # Looking for regexp "\(\(?:^\|
\)[^]#$%>
]*#?[]#$%>] *\(\[[0-9;]*[a-zA-Z] *\)*\)\'" from remote shell
21:44:11.775629 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.775732 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.775842 tramp-process-one-action (5) # Looking for regexp "\(\(Are you sure you want to continue connecting (yes/no)\?\)\s-*\)\'" from remote shell
21:44:11.775945 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776051 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776160 tramp-process-one-action (5) # Looking for regexp "\(\(\(?:Store key in cache\? (y/\|Update cached key\? (y/n, Return cancels connectio\)n)\)\s-*\)\'" from remote shell
21:44:11.776262 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776382 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776494 tramp-process-one-action (5) # Looking for regexp "\(\(TERM = (.*)\|Terminal type\? \[.*\]\)\s-*\)\'" from remote shell
21:44:11.776597 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776696 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776801 tramp-process-one-action (5) # Looking for regexp "\(\)\'" from remote shell
21:44:11.776909 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.776972 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.777034 tramp-process-one-action (5) # Call ‘tramp-action-process-alive’
21:44:11.777101 tramp-get-connection-property (7) # gateway nil
21:44:11.777654 tramp-accept-process-output (10) # *tramp/ssh syj@147.46.219.160* run *tramp/ssh syj@147.46.219.160*

21:44:11.777758 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
21:44:11.777833 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.777902 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.777993 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*:? *\)\'" from remote shell
21:44:11.778085 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778147 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778244 tramp-process-one-action (5) # Looking for regexp "\(^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host key verification failed\.\|Login \(?:[Ii]ncorrect\)\|N\(?:ame or service not known\|o supported authentication methods left to try!\)\|Permission denied\|\(?:Sorry, try again\|Timeout, server not responding\)\.\).*\|^.*\(Received signal [0-9]+\).*\)\'" from remote shell
21:44:11.778315 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778379 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778448 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
21:44:11.778515 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778577 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778641 tramp-process-one-action (5) # Looking for regexp "\(\(?:^\|
\)[^]#$%>
]*#?[]#$%>] *\(\[[0-9;]*[a-zA-Z] *\)*\)\'" from remote shell
21:44:11.778707 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778765 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778851 tramp-process-one-action (5) # Looking for regexp "\(\(Are you sure you want to continue connecting (yes/no)\?\)\s-*\)\'" from remote shell
21:44:11.778923 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.778986 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779052 tramp-process-one-action (5) # Looking for regexp "\(\(\(?:Store key in cache\? (y/\|Update cached key\? (y/n, Return cancels connectio\)n)\)\s-*\)\'" from remote shell
21:44:11.779117 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779176 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779243 tramp-process-one-action (5) # Looking for regexp "\(\(TERM = (.*)\|Terminal type\? \[.*\]\)\s-*\)\'" from remote shell
21:44:11.779323 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779387 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779449 tramp-process-one-action (5) # Looking for regexp "\(\)\'" from remote shell
21:44:11.779515 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779573 tramp-get-connection-property (7) # check-remote-echo nil
21:44:11.779632 tramp-process-one-action (5) # Call ‘tramp-action-process-alive’
21:44:11.779699 tramp-get-connection-property (7) # gateway nil
21:44:11.935643 tramp-accept-process-output (10) # *tramp/ssh syj@147.46.219.160* run *tramp/ssh syj@147.46.219.160*

缓冲区显示了很多转义序列,例如 [1m[33msyj[39m[0m[38;5;242m@[1m[36m。尝试在您的提示中摆脱它们; Tramp 手册解释了一些技巧。