Using Cygwin at Fermilab

So you're running Windows and you need to log into Linux machines at Fermilab. Cygwin is one way to do this. Cygwin is a UNIX-like environment that runs on top of Windows. Not only is it a great way to connect to remote Fermilab Linux machines, but it provides a UNIX-like way of interacting with your Windows programs (e.g. bash shell scripts, grep, Makefile, LaTeX, etc.). I think it's more useful than all that WRQ/Reflection/Putty/Xming stuff and the price is right!

These instructions will show how to install Cygwin with Kerberos and basic X windows support. You'll need to request a Kerberos Fermilab Domain Principal before you can get a kerberos ticket.

  1. Download the Cygwin setup-x86_64 program and run it as admin to install Cygwin on your PC. By default the setup program will put the bare minimum number of "packages" on your PC. In the setup program search through the list of available packages and also install the following stuff: The basic Cygwin install plus the packages listed above should be about 500MB. By default Cygwin will install in c:\cygwin64. Note you can always re-run the Cygwin setup program to add more packages or update the packages you've already installed.
  2. Start a Cygwin64 terminal. The first time it runs it should make a home directory for you in /home (c:\cygwin64\home).
  3. Get the latest Fermilab krb5.conf and put it in /etc (c:\cygwin64\etc). You might need to have windows admin privileges to do this.
  4. Create a directory called .ssh in your home directory (c:\cygwin64\home\yourusername\) and put the ssh config file there.
    $ cd
    $ mkdir .ssh
    
  5. Change the protections on the ssh config file
    $ chmod 600 ~/.ssh/config
  6. Edit your startup script ~/.bashrc (c:\cygwin64\home\yourusername\.bashrc)
    $ nano .bashrc
    and somewhere in that file include the line:
    export DISPLAY=:0.0
    This is so X will know which screen to use. If you get "can't open display" error messages double check your .bashrc file to make sure it has the above line. Save .bashrc, close all open Cygwin64 terminals.
  7. Now try it out! Open a Cygwin64 terminal and type:
    $ kinit your-kerberos-name@FNAL.GOV (after entering your password you'll have a kerberos ticket)
    
    $ klist (displays your kerberos ticket)
    
    $ startxwin& (this will start the X server in the background)
    
    $ xclock& (you should see an analog clock window appear; this is running LOCALLY)
    
    $ ssh yourusername@someothermachine.fnal.gov  (connect to a remote machine; if you have a ticket 
                                                   AND the remote machine is supports kerberos AND you 
                                                   have an account on that machine it should log you 
                                                   right in without any prompts for username or password)
    
    $ xclock& (another clock should appear; this clock is actually running on the remote machine
               but is displayed on your screen... this is what X windows does for you)
    

A word of warning... the Cygwin package nc (aka netcat) will get flagged by the anti-virus scanner and will result in your windows PC getting blocked from the network if on site. nc is not normally installed with the base Cygwin packages, but it could be installed if you install ALL "net" packages.

If you think this 1994-retro HTML page was helpful, or if something is unclear, email me at jamieson@fnal.gov
last update 2017-05-10