Useful Configuration of Cygwin, Part 2: SSH and Vim
Setting up SSH
One great thing about having this setup is the ability to be able to
ssh to and from remote boxes to your Windows box and to be able to
transfer files with the scp command. To do this SSH needs to be
properly set up. It is a fairly simple matter. Just run the
command ssh-host-config from
Here is how I answer the following questions:
Should privilege separation be used?
Which value should the environment variable CYGWIN have when
sshd starts? It's recommended to set at least "ntsec" to be
able to change user context without password.
Default is "ntsec". CYGWIN=
Do you want to install sshd as service?
(Say "no" if it's already installed as service) (yes/no)
also be asked if you want it to generate some keys and whether you want
to use them to log on. I definitely say "no" to the RSA 1 key and
say yes to both RSA and DSA 2 keys.
Next launch start the service with the following command:
Now in the Services window of Administrative Tools under Control Panel you
should see the CYGWIN sshd
Setting up the Vim editor
Vim (Vi IMproved) is
another extremely useful and important tool that comes with Cygwin.
The long and short of getting it running properly is to set up a
config file in your home directory. There is already provided a
good example which you can copy to your home directory:
is dependent upon the version NN of vim installed (in this case v.6.3).
Here is another tip: vim comes with the
command which is an alias that opens a file in in Vim in read-only
mode. Using view
you can view files with syntax-highlighting and line number display just
as in vim (provided you set up your
Listing package contents
If you want to know the contents of a Cygwin package use the
command to list them. For example:
cygcheck.exe -l vim |
will list the contents of the vim package.
Using sc.exe to control services remotely
Now that you have a functional shell environment and the ability to
use ssh to open a remote console session one very useful command to know
Sc.exe is not part of Cygwin but rather is included with Windows XP and
later. For Windows 2000 it was included as part of a collection of
command-line utilities called the Server Extensions Resource kit.
If you do not have this command on your system (hint: run
in your BASH shell to see if/where it is) you can find places to
Sc.exe allows you to query running services, search for a particular
service, and to start, stop, and restart services. Here is an