Other

[Emacs] Emacs使用Tramp Mode访问远程文件

2016-05-11  本文已影响873人  何幻

TRAMP (Transparent Remote Access, Multiple Protocols) is for transparently accessing remote files from within Emacs. TRAMP enables an easy, convenient, and consistent interface to remote files as if they are local files.

使用方法:直接按如下格式打开远程文件即可,

C-x C-f /ssh:username@server.net:path/to/file.txt RET
C-x C-f /ssh:username@server.net:path/to/directory/ RET

注:
sftp是Secure File Transfer Protocol的缩写,即安全文件传送协议。
Tramp Mode不支持sftp协议,在打开/sftp:username@server.net:path/to/file.txt时会提示:

byte-code: Unknown method "sftp"

原因:

This is problematic with hosting accounts where access is only via sftp… other protocols (such as ssh) are disabled.

解决方案:
如果服务器还支持ssh的话,可以使用/ssh:username@server.net:path/to/file.txt代替。


参考:
EmacsWiki: Tramp Mode
TRAMP User Manual - GNU

上一篇 下一篇

猜你喜欢

热点阅读