본문 바로가기
컴퓨터 활용(한글, 오피스 등)/50_2.운영체제_리눅스

Tramp on Windows

by 3604 2023. 12. 6.
728x90

출처: https://www.emacswiki.org/emacs/Tramp_on_Windows

 

Install PuTTY and make sure plink.exe is on your PATH.

Now you can use something like the following: /plink:alex@example.org.

If you always use the plink method, you can make it the default:

(setq tramp-default-method "plink")

Or you can put it all together like this such that your init file will work for both Windows and other operating systems:

(when (eq window-system 'w32)
  (setq tramp-default-method "plink")
  (when (and (not (string-match putty-directory (getenv "PATH")))
	     (file-directory-p putty-directory))
    (setenv "PATH" (concat putty-directory ";" (getenv "PATH")))
    (add-to-list 'exec-path putty-directory)))

If you use pscp instead of plink, tramp-do-copy-or-rename-file-out-of-band will do executable-find for the copy-program, and executable-find will search on exec-path, not on (getenv PATH). I assume exec-path is initialised from (getenv PATH) (also see ExecPath), but they are not automatically kept in sync, so we have to do it ourselves.

If you need to specify additional properties for your connection (like a private key file, keepalives, etc) one easy way is to create and save a session with your desired properties in PuTTY’s gui program and then connect using your saved session by C-x C-f then

/plinkx:sessname:/path/to/your/file/on/server

where sessname is the name of your saved session in PuTTY.

For general information and troubleshooting, see Tramp Mode.

728x90