Question

I'm trying to get emacs tramp running under Windows XP to work over putty plink on an Amazon EC2 instance. The documentation for doing this is sparse. I can find partial documentation, but none that addresses all the steps required to get this working.

Can anyone provide a walk through, or a pointer to a walk through?

Was it helpful?

Solution

(add-to-list 'load-path
 (expand-file-name "C:/tools/emacsw32/emacs/lisp/tramp/lisp"))
(require 'tramp)
;(setq tramp-chunksize "500")
(setq tramp-default-method "plink")

from my dot-emacs file. If I find more notes, I shall add them here.

OTHER TIPS

I'll assume you have a GNU/Linux server you want to access, a username and a .ppk file. Also, Emacs 24.4+.

First set up server in PuTTY Configuration

  1. In section Session, specify Host Name, for example username@server.
  2. Go to section Connection > SSH > Auth and Browse for your "Private key file for authentication".
  3. Back to section Session, name your Saved Sessions, for example putty-test, and click Save button.
  4. Check your connection by clicking the Open button. If it works, you can close these now.

Next, head to your Emacs.

  1. Make sure Emacs knows where your plink.exe is. One way is to just inform Emacs directly in your .emacs, for instance I have at the moment, (setenv "PATH" (concat "c:/Users/Brady/Documents/putty/;" (getenv "PATH")))
  2. Simply type C-x C-f //plink:putty-test:/ RET. Wait a moment while it connects, and window will open to dired buffer on the remote ~/ directory.

This worked for me on :

The changes from the original tramp-sh.el is

  • for cygwin, use fakecygpty with ssh and change the prompt to ##
  • for plink, remove -ssh option

I have also renamed these method with w to differentiate it.

(when (string-equal system-type "windows-nt")
  (add-to-list 'tramp-methods
               `("sshw"
                 (tramp-login-program        "fakecygpty ssh")
                 ;; ("%h") must be a single element, see `tramp-compute-multi-hops'.
                 (tramp-login-args           (("-l" "%u" "-o \"StrictHostKeyChecking=no\"") ("-P" "%p") ("-t")
                                              ("%h") ("\"")
                                              (,(format
                                                 "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
                                                 tramp-terminal-type
                                                 "##"))
                                              ("/bin/sh") ("\"")))
                 (tramp-remote-shell         "/bin/sh")
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-default-port         22))
               )

  (add-to-list 'tramp-methods
               `("plinkw"
                 (tramp-login-program        "plink")
                 ;; ("%h") must be a single element, see `tramp-compute-multi-hops'.
                 (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-t")
                                              ("%h") ("\"")
                                              (,(format
                                                 "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
                                                 tramp-terminal-type
                                                 "$"))
                                              ("/bin/sh") ("\"")))
                 (tramp-remote-shell         "/bin/sh")
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-default-port         22))
               )
  )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top