尝试 sudo 访问远程文件时 Emacs Tramp 出现问题
Trouble with Emacs Tramp when trying to sudo access remote file
在 Emacs25 中,我使用推荐的语法以 sudo 模式打开远程文件:
find-file "/ssh:ichiban@izu|sudo:ichiban@izu:~/
但 Emacs 只是挂起。我在我的 .emacs 文件中设置了一些 degging 设置:
(require 'tramp)
;(setq tramp-debug-buffer t)
(setq tramp-verbose 10)
; to enable tracing in tramp
(require 'trace)
(dolist (elt (all-completions "tramp-" obarray 'functionp))
(trace-function-background (intern elt)))
(untrace-function 'tramp-read-passwd)
(untrace-function 'tramp-gw-basic-authentication)
但是得到的信息没有任何帮助。
为了查看该信息,我从终端启动 Emacs,然后在它挂起时从终端向它发送 Ctrl-c(没有 return)- 然后我可以读取调试数据。
没有 sudo 模式它工作正常:
find-file "/ssh:ichiban@izu:~/
我想查看有关 Emacs 使用的协议的更多详细信息,并了解如何调整该协议 - 任何想法都将不胜感激。
这是 "sudo" 和 "non sudo" 案例的调试输出不同之处:
失败:sudo case /ssh:ichiban@izu|sudo:ichiban@izu:/home/ichiban
15:12:54.224210 tramp-maybe-open-connection (3) # Opening connection for ichiban@izu using sudo...
15:12:54.240334 tramp-get-local-locale (7) # locale en_US.utf8
15:12:54.240731 tramp-compute-multi-hops (5) # Add proxy ("izu" "ichiban" "/ssh:ichiban@izu:")
15:13:08.214197 tramp-maybe-open-connection (3) # Opening connection for ichiban@izu using sudo...failed
成功 :非 sudo 案例 /ssh:ichiban@izu:/home/ichiban
15:02:58.629883 tramp-maybe-open-connection (3) # Opening connection for ichiban@izu using ssh...
15:02:58.647868 tramp-get-local-locale (7) # locale en_US.utf8
15:02:58.648444 tramp-get-connection-property (7) # login-args undef
15:02:58.648777 tramp-get-connection-property (7) # login-args undef
15:02:58.649111 tramp-call-process (6) # ‘ssh -o ControlMaster’ nil *temp*
15:02:58.651325 tramp-call-process (6) # 255
command-line line 0: missing argument.
15:02:58.651640 tramp-call-process (6) # ‘ssh -o ControlPath=%C 0.0.0.1’ nil *temp*
15:02:58.655076 tramp-call-process (6) # 255
Pseudo-terminal will not be allocated because stdin is not a terminal.
find-file "/ssh:ichiban@izu|sudo:ichiban@izu:~/
您几乎肯定想使用:
find-file "/ssh:ichiban@izu|sudo:root@izu:~/
或等效(因为 root 是此方法的默认用户)和更短的:
find-file "/ssh:ichiban@izu|sudo:izu:~/
我敢猜测 Emacs 挂起是因为 tramp 处于无限循环中,试图解析您给它的代理——您告诉它使用代理 /ssh:ichiban@izu:
当以 ichiban@izu
!
访问文件时
请M-x report-emacs-bug
建议添加一些循环检测来防止这种情况。
在 Emacs25 中,我使用推荐的语法以 sudo 模式打开远程文件:
find-file "/ssh:ichiban@izu|sudo:ichiban@izu:~/
但 Emacs 只是挂起。我在我的 .emacs 文件中设置了一些 degging 设置:
(require 'tramp)
;(setq tramp-debug-buffer t)
(setq tramp-verbose 10)
; to enable tracing in tramp
(require 'trace)
(dolist (elt (all-completions "tramp-" obarray 'functionp))
(trace-function-background (intern elt)))
(untrace-function 'tramp-read-passwd)
(untrace-function 'tramp-gw-basic-authentication)
但是得到的信息没有任何帮助。
为了查看该信息,我从终端启动 Emacs,然后在它挂起时从终端向它发送 Ctrl-c(没有 return)- 然后我可以读取调试数据。
没有 sudo 模式它工作正常:
find-file "/ssh:ichiban@izu:~/
我想查看有关 Emacs 使用的协议的更多详细信息,并了解如何调整该协议 - 任何想法都将不胜感激。
这是 "sudo" 和 "non sudo" 案例的调试输出不同之处:
失败:sudo case /ssh:ichiban@izu|sudo:ichiban@izu:/home/ichiban
15:12:54.224210 tramp-maybe-open-connection (3) # Opening connection for ichiban@izu using sudo...
15:12:54.240334 tramp-get-local-locale (7) # locale en_US.utf8
15:12:54.240731 tramp-compute-multi-hops (5) # Add proxy ("izu" "ichiban" "/ssh:ichiban@izu:")
15:13:08.214197 tramp-maybe-open-connection (3) # Opening connection for ichiban@izu using sudo...failed
成功 :非 sudo 案例 /ssh:ichiban@izu:/home/ichiban
15:02:58.629883 tramp-maybe-open-connection (3) # Opening connection for ichiban@izu using ssh...
15:02:58.647868 tramp-get-local-locale (7) # locale en_US.utf8
15:02:58.648444 tramp-get-connection-property (7) # login-args undef
15:02:58.648777 tramp-get-connection-property (7) # login-args undef
15:02:58.649111 tramp-call-process (6) # ‘ssh -o ControlMaster’ nil *temp*
15:02:58.651325 tramp-call-process (6) # 255
command-line line 0: missing argument.
15:02:58.651640 tramp-call-process (6) # ‘ssh -o ControlPath=%C 0.0.0.1’ nil *temp*
15:02:58.655076 tramp-call-process (6) # 255
Pseudo-terminal will not be allocated because stdin is not a terminal.
find-file "/ssh:ichiban@izu|sudo:ichiban@izu:~/
您几乎肯定想使用:
find-file "/ssh:ichiban@izu|sudo:root@izu:~/
或等效(因为 root 是此方法的默认用户)和更短的:
find-file "/ssh:ichiban@izu|sudo:izu:~/
我敢猜测 Emacs 挂起是因为 tramp 处于无限循环中,试图解析您给它的代理——您告诉它使用代理 /ssh:ichiban@izu:
当以 ichiban@izu
!
请M-x report-emacs-bug
建议添加一些循环检测来防止这种情况。