EMACS-DOCUMENT

=============>集思广益

如何配置Tramp使得只需要输入一次密码就可以让Emacs把远程服务器当成本地服务器那样来用

你只需要启用ssh的 connection sharing功能就行了. 方法是编辑本地的 ~/.ssh/config 文件然后添加下面这些配置:

Host *
    # Enable connection sharing.
    ControlMaster auto
    ControlPath ~/.ssh/%r@%h:%p
    # Make persistent connections that can be reused.
    ControlPersist yes
    # Keep connections alive (helps TRAMP to detect disconnects.)
    ServerAliveInterval 5

然后在Emacs中配置参数 tramp-use-ssh-controlmaster-optionsnil