使用doom下集成的emacs-ssh-deploy提示timeout请求超时

在终端可以正常ssh命令登录远程服务器。 现在想使用ssh-deploy访问远程的已存在内容的目录test
第二步操作超时了。
第一步:在本地创建 map 目录
在本地创建了test空目录,在test目录中添加ssh-deply配置文件.dir-locals.el

((nil . (
  (ssh-deploy-root-local . "/Users/mac/me/test/")
  (ssh-deploy-root-remote . "/ssh:[email protected]:/Users/test/test/")
)))

第二步:查看远程目录
ssh-deploy-browse-remote-handler命令查看过程,提示:

Tramp: Opening connection for [email protected] using ssh...failed
Cleaning up the recentf list...done (0 removed)
Tramp: ‘getconf PATH’ not successful, using default value "/bin:/usr/bin".
Tramp: Opening connection for [email protected] using ssh...
Tramp: Sending command ‘exec ssh -l testserver  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none ipa.server.com’
Tramp: Waiting for prompts from remote shell...
Tramp: Sending Password
Timeout reached, see buffer ‘*tramp/ssh [email protected] ipa.server.com*’ for details

是用密钥登录的么,咋看起来最后 Sending Password 超时了,建议贴出 *tramp/ssh [email protected] ipa.server.com* 内容,以及参考 EmacsWiki: Tramp Mode tramp hang 的那些情况

没找到tramp/ssh [email protected] ipa.server.com, 这个buffer在哪里?

你问我在哪里我也不知道你的在哪里呀😂,按说正常切换 buffer 就有了

也可以试着把 tramp-verbose 调高点看看

重新尝试了两种情况连接远程:
第一种:免密码配置,这种一直出现超时情况,无法连接远程服务器。
第二种:帐号登录[email protected],经测试,用户名区分大小写,可以正常连接远程ssh服务,否则会出现连接超时的情况。

ssh免密码连接超时失败,不知道是啥原因,配置如下:
~/.ssh/config,ssh-deploy要求IdentityFile必须是私有密钥。

Host Test
    HostName ipa.server.com
    IdentityFile /Users/me/id_rsa

在.dir-locals.el

(ssh-deploy-root-remote . "/ssh:Test:/Users/test/test/")

你先不用管 ssh-deploy,看 tramp 是否正常就行了。tramp 支持 IndetityFile,(setq tramp-verbose 10) 看结果。

收集到了这些日志:

  backtrace()
  tramp-signal-hook-function(file-error ("Timeout reached, see buffer ‘*tramp/ssh Test*’ for..."))
  signal(file-error ("Timeout reached, see buffer ‘*tramp/ssh Test*’ for..."))
  tramp-maybe-open-connection((tramp-file-name "ssh" nil nil "Test" nil "/bin" nil))
  tramp-send-command((tramp-file-name "ssh" nil nil "Test" nil "/bin" nil) "test 0 2>/dev/null; echo tramp_exit_status $?")
  tramp-send-command-and-check((tramp-file-name "ssh" nil nil "Test" nil "/bin" nil) "test 0")
  tramp-get-test-command((tramp-file-name "ssh" nil nil "Test" nil "/bin" nil))
  tramp-run-test("-d" "/ssh:Test:/bin")
  tramp-sh-handle-file-directory-p("/ssh:Test:/bin")
  apply(tramp-sh-handle-file-directory-p "/ssh:Test:/bin")
  tramp-sh-file-name-handler(file-directory-p "/ssh:Test:/bin")
  apply(tramp-sh-file-name-handler file-directory-p "/ssh:Test:/bin")
  tramp-file-name-handler(file-directory-p "/ssh:Test:/bin")
  file-directory-p("/ssh:Test:/bin")
  #f(compiled-function (x) #<bytecode 0x1fef074ba5f9>)("/bin")
  mapcar(#f(compiled-function (x) #<bytecode 0x1fef074ba5f9>) ("/bin" "/usr/bin" nil nil "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin"))
  tramp-get-remote-path((tramp-file-name "ssh" nil nil "Test" nil "/Users/me/.jinher" nil))
  tramp-get-remote-readlink((tramp-file-name "ssh" nil nil "Test" nil "/Users/me/.jinher" nil))
  tramp-sh-handle-file-truename("/ssh:Test:/Users/me/.jinher")
  apply(tramp-sh-handle-file-truename "/ssh:Test:/Users/me/.jinher")
  tramp-sh-file-name-handler(file-truename "/ssh:Test:/Users/me/.jinher")
  apply(tramp-sh-file-name-handler file-truename "/ssh:Test:/Users/me/.jinher")
  tramp-file-name-handler(file-truename "/ssh:Test:/Users/me/test")
  file-truename("/ssh:Test:/Users/me/test")
  dired-noselect("/ssh:Test:/Users/me/test" nil)
  #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x1feee331b47d>)("/ssh:Test:/Users/me/test" nil)
  ls-lisp--dired(#f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x1feee331b47d>) "/ssh:Test:/Users/me/test")
  apply(ls-lisp--dired #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x1feee331b47d>) "/ssh:Test:/Users/me/test")
  dired("/ssh:Test:/Users/me/test")
  ssh-deploy-browse-remote("/Users/boyer/hsg/test/" "/Users/boyer/hsg/test/" "/ssh:Test:/Users/me/test/" ("\\.git/" "\\.dir-locals\\.el"))
  ssh-deploy-browse-remote-handler()
  funcall-interactively(ssh-deploy-browse-remote-handler)
  call-interactively(ssh-deploy-browse-remote-handler nil nil)
  command-execute(ssh-deploy-browse-remote-handler)

你这个不是 tramp 的日志,正确的应该是长这样的(*debug tramp/ssh 144*),我觉得你还是(switch-buffer "*tramp/ssh Test*") 看看吧,如果还是没法切换 buffer,可能要问问 doom 做了啥操作:

15:52:40.694809 tramp-get-local-locale (7) # locale en_US.UTF-8
15:52:40.695303 tramp-get-connection-property (7) # login-args undef; cache used: nil
15:52:40.695545 tramp-get-connection-property (7) # process-name nil; cache used: nil
15:52:40.695696 tramp-get-connection-property (7) # process-buffer nil; cache used: t
15:52:40.717987 tramp-maybe-open-connection (6) # /bin/sh -i
15:52:40.718830 tramp-get-connection-property (7) # process-buffer nil; cache used: t
15:52:40.720131 tramp-get-connection-property (7) # check-remote-echo nil; cache used: nil
15:52:40.720286 tramp-get-connection-property (7) # check-remote-echo nil; cache used: nil
15:52:40.720907 tramp-get-connection-property (7) # locked nil; cache used: nil
15:52:40.721195 tramp-set-connection-property (7) # locked t
15:52:40.732785 tramp-accept-process-output (10) # *tramp/ssh 144* nil run t
#$ 
15:52:40.732976 tramp-flush-connection-property (7) # locked
15:52:40.733110 tramp-get-connection-property (7) # check-remote-echo nil; cache used: nil
15:52:40.733194 tramp-get-connection-property (7) # check-remote-echo nil; cache used: nil
15:52:40.733332 tramp-wait-for-regexp (6) # 
#$ 
17:51:16.504943 tramp-process-actions (10) # 
  backtrace()
  tramp-error((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil) file-error "Timeout reached, see buffer ‘*tramp/ssh TestServer...")
  apply(tramp-error (tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil) file-error "Timeout reached, see buffer ‘*tramp/ssh TestServer..." nil)
  tramp-process-actions(#<process *tramp/ssh [email protected]*> (tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil) 1 ((tramp-login-prompt-regexp tramp-action-login) (tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) (shell-prompt-pattern tramp-action-succeed) (tramp-shell-prompt-pattern tramp-action-succeed) (tramp-yesno-prompt-regexp tramp-action-yesno) (tramp-yn-prompt-regexp tramp-action-yn) (tramp-terminal-prompt-regexp tramp-action-terminal) (tramp-antispoof-regexp tramp-action-confirm-message) (tramp-process-alive-regexp tramp-action-process-alive)) 60)
  tramp-maybe-open-connection((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil))
  tramp-send-command((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil) "test 0 2>/dev/null; echo tramp_exit_status $?")
  tramp-send-command-and-check((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil) "test 0")
  tramp-get-test-command((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/bin" nil))
  tramp-run-test("-d" "/ssh:[email protected]:/bin")
  tramp-sh-handle-file-directory-p("/ssh:[email protected]:/bin")
  apply(tramp-sh-handle-file-directory-p "/ssh:[email protected]:/bin")
  tramp-sh-file-name-handler(file-directory-p "/ssh:[email protected]:/bin")
  apply(tramp-sh-file-name-handler file-directory-p "/ssh:[email protected]:/bin")
  tramp-file-name-handler(file-directory-p "/ssh:[email protected]:/bin")
  file-directory-p("/ssh:[email protected]:/bin")
  #f(compiled-function (x) #<bytecode 0x1feedf3d8cc1>)("/bin")
  mapcar(#f(compiled-function (x) #<bytecode 0x1feedf3d8cc1>) ("/bin" "/usr/bin" nil nil "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin"))
  tramp-get-remote-path((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/Users/me/teamdoc" nil))
  tramp-get-remote-readlink((tramp-file-name "ssh" "TestServer" nil "ipa.server.com" nil "/Users/me/teamdoc" nil))
  tramp-sh-handle-file-truename("/ssh:[email protected]:/Users/t...")
  apply(tramp-sh-handle-file-truename "/ssh:[email protected]:/Users/t...")
  tramp-sh-file-name-handler(file-truename "/ssh:[email protected]:/Users/t...")
  apply(tramp-sh-file-name-handler file-truename "/ssh:[email protected]:/Users/t...")
  tramp-file-name-handler(file-truename "/ssh:[email protected]:/Users/t...")
  file-truename("/ssh:[email protected]:/Users/t...")
  dired-noselect("/ssh:[email protected]:/Users/t..." nil)
  #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x1feee331b47d>)("/ssh:[email protected]:/Users/t..." nil)
  ls-lisp--dired(#f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x1feee331b47d>) "/ssh:[email protected]:/Users/t...")
  apply(ls-lisp--dired #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x1feee331b47d>) "/ssh:[email protected]:/Users/t...")
  dired("/ssh:[email protected]:/Users/t...")
  ssh-deploy-browse-remote("/Users/me/teamdoc/" "/Users/me/teamdoc/" "/ssh:[email protected]:/Users/t..." ("\\.git/" "\\.dir-locals\\.el"))
  ssh-deploy-browse-remote-handler()
  funcall-interactively(ssh-deploy-browse-remote-handler)
  call-interactively(ssh-deploy-browse-remote-handler nil nil)
  command-execute(ssh-deploy-browse-remote-handler)
17:51:16.505589 tramp-process-actions (1) # File error: Timeout reached, see buffer ‘*tramp/ssh [email protected]*’ for details
Last login: Wed Jun 30 17:48:45 2021 from 192.168.100.1
%                                                                              
 

[email protected] ~ % e[?2004h
17:51:46.544390 tramp-process-actions (3) # Waiting for prompts from remote shell...failed
17:51:46.545139 tramp-maybe-open-connection (3) # Opening connection for [email protected] using ssh...failed
17:51:46.545540 tramp-get-file-property (8) #  file-truename nil
17:51:46.545894 tramp-flush-directory-properties (8) # 
17:51:46.546256 tramp-get-connection-property (7) # process-name nil
17:51:46.546608 tramp-flush-connection-properties (7) # (tramp-file-name ssh me nil ipa.server.com nil nil nil) (first-password-request process-buffer)
17:51:46.547042 tramp-get-connection-property (7) # process-buffer nil

17:51:46.544390 tramp-process-actions (3) # Waiting for prompts from remote shell...failed 远程 SHELL 是 ZSH?在 .zshrc 最前面加 [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return 了么

谢谢,服务器端也是zsh,在.zshrc 头行添加[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return,可以正常连接了。

这里面就有,你不仔细看😂