Using Tramp with Cygwin and GNU Emacs on Windows

I use GNU Emacs 21.2 (aka "NT-Emacs") with Cygwin on Microsoft Windows. With the emacs-lisp package TRAMP, you can use numerous methods for remote editing, similar to how ange-ftp uses ftp. Where security requires it, you can use ssh (specifically, the Cygwin version of OpenSSH), instead of ftp.

If you are familiar with Emacs, Cygwin and OpenSSH, it's not complicated at all. The only major problem is that the elisp packages tramp and cygwin-mount cannot be used together.

Pre-requisites

Procedure

  1. Install TRAMP. See the resources below for download information. It is sufficient to unpack the tramp/lisp/*.el files into Emacs' site-lisp directory.

  2. Put the following statements in your ~/.emacs file:
        (require 'tramp)
        (setq tramp-default-method "smx")
        (setq tramp-debug-buffer t) 
    The last line is optional, but certainly a good idea when trying something new like this with tramp.

  3. Ensure that your emacs "bin" directory is in your Cygwin bash shell PATH. For example, in my ~/.bashrc file, I set my PATH as follows:
        export PATH="/usr/local/bin:/bin:/c/gnu/emacs-21.2/bin:/c/WINDOWS/COMMAND:/c/WINDOWS" 
    (I have mounted C: as /c/. You can do likewise or use /cygdrive/c/ instead.)

  4. In the Cygwin bash shell, authenticate yourself with ssh-agent and ssh-add. Something like:
        bash$ eval `ssh-agent`
        bash$ ssh-add
        [type your passphrase when prompted] 

  5. Start Emacs by typing runemacs in the Cygwin bash shell:
        bash$ runemacs 

  6. In Emacs, visit your remote home directory with:
        C-x C-f /[user@remotehost]
    Success! (Right?)

Discussion


References

GNU Emacs
GNU Emacs
GNU Emacs FAQ for Windows
Cygwin
Cygwin Project home page
Cygwin FAQ
Emacs-lisp packages
Tramp home page
cygwin-mount.el from emacswiki.org
OpenSSH
OpenSSH home page

Back to David's Home Page


Page maintained by David Starks-Browning <david@starks-browning.com>
Last modified: Mon May 27 20:26:18 GMT Daylight Time 2002