Cygwin: Changing the Face of Windows

Glueing together Cygwin's odds and ends to make life on your Linux-by-way-of-Windows desktop more comfortable.
Remote Display

Use the X11 forwarding feature of SSH to get rid of the export DISPLAY routine that is inherent to XDMCP (X Display Manager Control Protocol). When I tried to install SSH, the proxy server made a mess of it. I tried to install it manually but received errors because a cryptographic library in the SSL package was not installed yet. So don't forget to add SSL when installing SSH. If you use the setup.exe tool, these dependencies are satisfied automatically.

Because no default SSH configuration is present, you need to go through the following steps to set up the SSH client configuration decently:

  • Create an ssh_config file in /etc. If you do not have the Cygwin version of vim installed yet, use these echo commands to obtain the file:

    	echo "ForwardX11 yes" > /etc/ssh_config
    	echo "ForwardAgent yes" >> /etc/ssh_config
  • If you do not create this file, you have to set the DISPLAY variable locally before connecting to a remote server:

    	export DISPLAY=localhost:0.0

If you want to be able to connect to your Windows workstation using SSH, you need to perform these additional steps to run the SSH daemon:

  • Copy sshd_config and ssh_config from an existing UNIX machine to the Cygwin /etc directory, and make sure X11 forwarding is enabled.

  • Generate SSH host keys. This does not work off the bat, because the file does not exist. The solution is to run touch /etc/ssh_host_dsa_key and then generate the key using ssh-keygen and overwrite.

  • Change permissions on your private host key to 600.

  • Run mkpasswd and mkgroup, which create UNIX-style /etc/passwd and /etc/group files based on Windows user information.

  • Create the SSH privilege separation user, adding a line like the following to /etc/passwd:

      sshd:*:74:74:SSH Privilege Separation User:/var/empty/sshd:/sbin/nologin
  • Start /usr/sbin/sshd

Now start SSH with the -Y option:

ssh -Y user@remote_host

Check the DISPLAY variable when you are logged in to the remote server; it should say something like remote_host:14.0. You now can start any graphical UNIX application, and it will be displayed on your Windows desktop.

For the Die-Hards

While testing the graphical applications, I noticed that a number of GNOME applications are included in the package list. All the libraries that you need to run GNOME programs already are ported, but a full-blown desktop is not available yet--unless you do some compilation yourself, of course. As a workaround, use the standard -query option to the X server to display a complete remote desktop:

/usr/X11R6/bin/XWin.exe -query remote_host

On Solaris, the XDMCP feature still is enabled by default. On Linux, you need to change your XDM configuration, preferably serve fonts and your GNOME or KDE configuration. On my Fedora box, I did the following:

  • Comment the line DisplayManager.requestPort in /etc/X11/xdm/xdm-config.

  • Uncomment #* # any host can get a login window line in /etc/xdm/Xaccess.

  • Comment no-listen = tcp in /etc/X11/fs/config.

  • Run /etc/init.d/xfs restart

  • In /etc/X11/gdm/gdm.conf, change Enable=false to Enable=true.

  • Run pkill -HUP gdm.

Then, from the Windows station, make sure that the X server is stopped before entering the X -query command.

This kind of remote display, however, is not optimized. I included it here only to demonstrate the capabilities of Cygwin. A faster solution is the VNC client/server. In this method, the client goes on your Windows machine, and the server either is enabled through the inet daemon or is run independently on any UNIX system. If you need to display only one application, the method described above--the example with SSH and xclock--probably is the fastest. The data automatically is compressed through the secure connection.

More ISA Troubles

The next problem I faced was the near-impenetrability of the MS ISA firewall/proxy. Although firewalls typically are designed to keep people out, our company's firewall was set up to keep people in. The only available ports for outgoing traffic were 80 and 443, HTTP and HTTPS. I wanted to connect to my home mail server. Also, being a system administrator, I'm used to having extra services available when solving troubles, such as IRC, my personal e-mail and my personal files. I had to get out of this prison. In the end, I managed to do so using an external Debian server. On that machine I configured SSH to listen on port 443 as well as on port 22, by simply entering this line to sshd_config:

Port 443

I then discovered that the normal text-based SSH client that comes with Cygwin does not support authentication using the Windows domain name with a user and password pair. Putty, however, did the trick.

Putty also helped me with the last problem: I was denied access to a variety of interesting sites, for the strangest of reasons--the automatic scanning performed by the ISA server. To be able to surf wherever I want, I installed Squid on my external server on the default port 3128. Then, still using the SSH connection to port 443, I also configured port forwarding. Putty was instructed to forward local port 80 to port 3128 of the remote server.

After starting that connection, I configured my browser to use localhost:80 as a proxy, and I once again could surf to and other interesting sites.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Great GNU software

Anonymous's picture

Have been using GNU CYGWIN as well as several other GNU software packages on windows for quite a long time now.
GNU CYGWIN is really great but is disappointing to see people thinking CYGWIN is a port of Linux (whihch wouldn't be anything without GNU).
Quite an informative article.

Cygwin in a Windows Environment

Anonymous Engineer's picture

I have found Cygwin to be a useful tool since B19. It just gets better and better.

The shell-scripting & text-processing tools (tcsh, sed, awk, perl, etc.) were a Godsend.

Nowadays, the X capabilities allow me to ignore Hummingbird's Exceed, invoke an xterm, and ssh -X user@machine...with more stabilty, in my experience.

The availability of emacs under Cygwin/X allowed me to standardize on one text editor for the multiple platforms I use.

I must use some Windows-only apps, otherwise I would switch over to linux, as I did at home. Also, It seems that some to some managers, data does not exist unless it is in Excel cells or Powerpoint. With animation.

Cygwin is one of those Good Things.

Blackbox + cygwin

Anonymous's picture

I've been using the native port of Blackbox on my Win2K workstation as an explorer.exe replacement. That plus cygwin/XFree86 and it's hard to tell I'm running Win2k (except when I'm running Quicken). Blackbox has a few minor bugs, but overall it's very usable and stable enough for rock an roll.

Windows Services for UNX (SFU) 3.5

Anonymous's picture

Cygwin is great and solves a bunch of problems. So is SFU 3.5 - in fact, in some areas of core POSIX semantics like signals, etc. SFU seems to be much more robust and provides a wider range of functionality than Cygwin. No X-Server in SFU though. And interesting thing is that it is a free download from Microsoft!

Your article is very wrong in

Anonymous's picture

Your article is very wrong in a couple of areas. Cygwin fully supports PTYs and signals for Cygwin-compiled apps, as well as many other POSIX capabilities such as IPC. Secondly, you should not do all that ssh setup by hand, just run the "ssh-user-config" script.

Linux Journal comment on Cygwin site outage?

Cygwin User's picture

Since this article is likely responsible for killing the Cygwin site, does Linux Journal have any information on when the Cygwin site will be back up?


cygwin site down

Anonymous's picture

The cygwin site has been down for at least the last day. Is cygwin still available somewhere?

Try one of these http://linux

Anonymous's picture

Try one of these or they are both the same just depends on your preference between http and ftp. Looks pretty up to date. In the release folder are all of the packages and options. If you could map the site to a network drive it would be easiest to run setup.exe and tell it is installing from the local directory. I don't think you can though so you probably have to download everything or dig for what you want.

All of the sites hosted by re

gene's picture

All of the sites hosted by redhat seem to be down right now that are under, such as cygwin and insight/gdb. However, I always use this mirror site for cygwin

Just get the setup.exe and run it and choose a mirror. For some reason this site always works for me, better than many much closer (to me) that you can choose in setup.

You can just select what you want from the setup program, no digging. is back!!!!

gene's picture

Oops, this won't work. As someone pointed out below setup.exe tries to connect to to get mirror list. However, there is a --site command line option for a non-default "download site" but can't seem to get it to work. ...But, just came back online while I was trying various other options. (So is

gone again

Anonymous's picture

It's gone again. Does anyone know if you can skip the install step that looks for the mirror list and just input one manually? Or how to use the option mentiont in the previous comment.

Cygwin for helping people migrate to Linux

Rex Ballard's picture

I've been using Cygwin for years as a way to introduce windows users to the world of *nix and especially Linux, without the trauma of repartitioning their hard drive, flipping between boot environments, or the expense of VMWare. Even today, I use cygwin on my corporate laptop because I have to have access to corporate applications which use ActiveX controls (yuck!!) and other "Windows only" capabilities. We are workind toward better support of "Linux-Only desktops" but until that day becomes a reality, cygwin is a great way to develop for ONE API (Linux/GNU/OpenSource) and have that application run on Linux, Windows, and most flavors of UNIX.

The article is very good. Unfortunately, for some reason the cygwin site has been taken off-line. I hope they bring it back up very soon. All that's really needed is the setup.exe - you can get to a number of exellent mirrors from there.

The other nice thing about cygwin is that it doesn't require lots of resources. The base installation with most of the applications will be smaller than a CD-ROM even when uncompressed. The X11 will still fit in less than 2 gig.

cygwin utility- the cygwin discussion list rejected this

marchywka's picture

( I searched the archives, this hasn't come up before and the question is
at the bottom- sorry for the long intro. I posted this on cygwin because
I run my scripts on cygwin and cygwin illustrates the relationship between
graphicly oriented things like windoze and information oriented systems
like linux. )
I've been using scripts now to access and organize searches from various
sources. Given the proliferation of documents and document types,
I think everyone recognizes the need for more structured documents and
the ability to easily do ad hoc searches and extractions- scripts make that
possible and indeed I have some examples to show that may be of
interest beyond specialized communities.
The federal government is one entity that collects structured documents
of public interest from a variety of sources. However, the
various agencies support automated access ( scripts) in highly
variable ways.
My favorite example of an information-friendly site is still the
ncbi api:
"Entrez Programming Utilities are tools that provide access to Entrez
data outside of the regular web query interface and may be helpful for
retrieving search results for future use in another environment."
( the IEEE you would think would he leading the charge in automated document
access but so far all I've seen is requests for money when I try to search
their journal databases)

As one example:

Most other sites seem to just accept that interactive access via
a web interface is how "normal people" will use the site- this
is just not practical or in the public interest at most sites.

Consider searching US patent documents- afaik you have to parse the
html document hits from their search engine- there is no way
to get documents returned in some simple to use format:

You do have a choice of tiff images but these of course offer nothing
unless you also have local OCR software. Try to do a search on
reasonable criteria and see that you get lots of hits- it is difficult to do
keyword searches without download a bunch of documents and
finding confounding words. I've got scripts to do much of this
but it would be easier if there was a stable API supported at uspto.
This site's "API" changes everytime they regenerate their site
since they seem to use generated code:

Or, consider the SEC website ( their webmaster has been very interested in this
but apparently an API is not currently a priority):

Public companies in the US submit lots of info of interest to the general public
but it is difficult to find and sort. Scripts offer a great solution for even casual
investors who happen to know a little programming. However, the SEC currently
forces you to either use the web interface or parse some cumbersome html.
Further, their full text search is being implremented with even more difficult to parse
html but it offers incredible benefits to those seeking to sort out potential
financial disasters ( for example, look at the option ARM situation):

Even FDA filings concerning the drugs we take are available but difficult to access
due to the web, rather than programming, interface that the FDA
presents- in this case they have all the important documents but
the search facilities are limited due to the data being presented as
scanned pdf files ( scripting very difficult):
( if you wanted to find all approved drugs with certain incidental properties,
this could be a great database except for the above issues)

I could go on and on about the government sources of info-
NOAA, CDC,FTC, various courts, etc - all provide great information of importance to the
public but access is artificially constrained for any serious uses. If it was available to
programmers, it could be repackaged at low cost and presented in a range
of web formats ( for even larger audiences). Of course- local governments
have even more information types (ranging from traffic cameras and abduction alerts to
court and property records)
that have audiences that could be more easily targeted by making the information
available for innovative programmers to re-distribute.

So, my question is, are there other people who have used cygwin for
these purposes and what sites have you accessed or attempted to access
in some script based way? Has anyone approached govt sites at
any level requesting computer friendly interaction mechanisms?
What responses have you gotten?

Many private sites make their money from things predicated on
interaction ( advertising for most sites- academic journals have a number
of revenue sources and I find it difficult to believe that they
would have problems with free, automated online access).
Does anyone have examples or thoughts
on free-to-user private entities that are still compatible with
automated access? 10kwizard had a nice service but they took
even their simple features into their subscription rather than free area.


The X11 will fit in MUCH

skullnobrains's picture

The X11 will fit in MUCH LESS than 2 gigs.
i had a full install will sshd xorg and KDE (not ALL apps) in less than 1.5 Go.

a minimal install of Xorg should fit in about 20 to 30 Megs when really slimmed down.

for those who like the X server, you may like Xming as well.
it is less full-featured (mainly missing xhosts support) and a little less stable, but easy to install and configure, and it is slightly more responsive than cygwin's Xorg. it runs as a daemon using cygrunsrv pretty easily.

for those who want speed with graphical apps, give colinux a try

...the latter two projects being in my opinion good complements to cygwin.

FSU is NOT FREELY downloadable for some versions of windows, is NOT PROPERLY documented if at all... and does not emulate all the POSIX subsystem as far as i know... just have a look at the file access rights...

good luck to all of you.

And the evidence for Xming

Anonymous's picture

And the evidence for Xming being less stable than Cygwin/X is?
Cygwin/X is only intermittently maintained, Xming is fully maintained and tracking bug fixes in Xorg.

Colin Harrison

Xming now has host-based access control via Xn.hosts

Anonymous's picture

Xming now has support for the simple host-based access control via Xn.hosts files.

I have the setup.exe and have

Anonymous's picture

I have the setup.exe and have run it. It seems though that it is trying to contact for the list of mirrors. If I select use HTTP/FTP Proxy do I directly enter the mirror address? If so is there a list available of mirror sites that have cygwin.

Cygwin for helping people migrate to Linux

Rex Ballard's picture

I've been using Cygwin for years as a way to introduce windows users to the world of *nix and especially Linux, without the trauma of repartitioning their hard drive, flipping between boot environments, or the expense of VMWare. Even today, I use cygwin on my corporate laptop because I have to have access to corporate applications which use ActiveX controls (yuck!!) and other "Windows only" capabilities. We are workind toward better support of "Linux-Only desktops" but until that day becomes a reality, cygwin is a great way to develop for ONE API (Linux/GNU/OpenSource) and have that application run on Linux, Windows, and most flavors of UNIX.

The article is very good. Unfortunately, for some reason the cygwin site has been taken off-line. I hope they bring it back up very soon. All that's really needed is the setup.exe - you can get to a number of exellent mirrors from there.

The other nice thing about cygwin is that it doesn't require lots of resources. The base installation with most of the applications will be smaller than a CD-ROM even when uncompressed. The X11 will still fit in less than 2 gig.

Cygwin site down?

Biker's picture

Is it just me or is the cygwin site ( down after this popular article ;-)

Cygwin site down?

Anonymous's picture

Yes it has been off line since at least Thursday. Where to find out what's up with that is a good questin, been searching for a while.

WTF has happened to

Anonymous's picture

WTF has happened to It's been inaccessible all day!

Cygwin server down???

dv's picture

For the last two days I have been completely unable to access any of the cygwin web servers or web pages or url's ( or * . Has anyone else noticed this. Did a server go down, or am I just unable to access. I tried it from several locations from servers in London, Korea, the Bay area, and San Diego and on several different providers so I couldn't imagine it's a routing problem or my home system. Thanks

I too cannot connect to cygwi

LoBush's picture

I too cannot connect to Most of the time I get this message box: "The connection was refused when attempting to contact" I've been trying for 3 or 4 days now to get there.

Cygwin down

BuddyLeeJr's picture

I am having the same trouble getting connected... I am stil searching around to see if anyone else has a copy or another mirror access...

Cygwin Down

BuddyLeeJr's picture

You can get a relatively new iso here:

Yes. I doubt that they are c

Anonymous's picture

Yes. I doubt that they are complete sets of packages but I havn't actually looked at it yet. Right now the entire mirror is 2.38GB in size. I am working on creating a distro that will contain the entire contents of a mirror on DVD for those that want it. I will get a friend of mine to review the other one that you mentioned though and see what he thinks.

Cygwin root

Anonymous's picture

I've been happily installing Cygwin with C:\ as the install root on lots of machines.
If you happen to have C:/bin, C:/etc, C:/usr and so on from another *nix emulation package or whatever, it's not a good idea -- but then again, do you?
There might be various reasons for using Cygwin. For me, I didn't want Cygwin to be a walled garden, I want to mingle the POSIX-like environment provided by Cygwin with whatever applications were the reason for using a Windows box in the first place. It's a bit easier if filesystem paths are more similar.

BTW, Cygwin includes utility commands to help you set up ssh, ssh_host_config and ssh_user_config. Please see /usr/share/doc/Cygwin/openssh.README before you try anything on your own.

If you use rxvt in Windows-native mode (rather than on an X-server), beware that rxvt sets DISPLAY. This is quite annoying when you ssh from a Windows-native rxvt, because ssh will call xauth to establish X forwarding and then subsequently hang. To avoid this, unset DISPLAY before calling ssh, or call ssh -x to avoid X forwarding.

I use Cygwin for some stuff and coLinux for other stuff

Anonymous's picture

If you haven't checked out coLinux then do so .
coLinux is like User-Mode-Linux under Windows + better preformance.

I wanted to use SNMP to query a device so I used Cygwin and linux snmp programs along with cron to schedule the snmp scans and data minipulation. It worked really well, I was able to use Cygwin to run Linux apps to get the SNMP info, then I was able to import the data into a Windows based MYSQL install (after grep, cut ,etc). Since I work at a Windows shop it was a great solution for me.

Problem with Cygwin is that you maybe one of the few people who are using it for the specific application. Just look at the Nagios mailing list some people reported getting it to run on Cygwin but never gave details. That is a case with coLinux really rocks if you do not want to dedicate a pure Linux machine to the task.


Please leave out the environm

Anonymous's picture

Please leave out the environment specific stuff about your company firewall. What does YOUR COMPANY FIREWALL have to do with my use of CYGWIN.

Some relavance please. This was a bad article.

you missed something

Machtelt's picture

The article _is_ a story about _my_ environment. Cygwin was just a way to make me feel better. If you want to read more about Cygwin, go to the Cygwin website, instead of reading bad articles ;-)

Cygwin != Linux

Anonymous's picture

Actually Cygwin is nothing to do with Linux since the Linux kernel is not involved at all.
Cygwin provides a GNU operating environment.
Perhaps if people were more willing to render unto GNU what is GNU's then more people would appreciate GNU's contribution and understand the need for the freedoms that GNU promotes.

GNU is great, but not everything.

Anonymous's picture

I think GNU just needs to render unto others what belongs to others. Most Free Software and Open-Source Software that did not originate with GNU, and to claim otherwise is self deceiving. Go look at all the software on your system and do the math.

GNU provided some very key fundamentals - EMACS, GCC, and lots of small command-line utilities, but doesn't overestimate the contribution, ok? The Free Software and Open-Source Software communities stand on the shoulders of giants - the work of GNU and the FSF, but they themselves stand on the shoulders of other giants - K&R for example :)

The Linux / Open-Source movement brought enthusiasm and new life to the Free Software movement. GNU should recognise that and stop being "glory hogs" and just get on with the job of writing software and spreading freedom.

Richard, is that you?

Anonymous's picture

Richard, is that you?

So all in all this is a story

Anonymous's picture

So all in all this is a story of one man's attempt at subverting company security policy. I don't think your peers would be too happy with you 1) installing unapproved software 2) hacking past a company firewall, and then 3) publishing details of your company security policy on the Internet.

What are you talking about? n

Anonymous's picture

What are you talking about? nonsense

Mr. Gates, is that you?

Anonymous's picture

Mr. Gates, is that you?

a woman, actually

Machtelt's picture

just trying to make people more aware of the false sense of security they have when they know themselves "protected" by a firewall. If you call this hacking, you're probably one of them.

hang on

Anonymous's picture

" is best to change the default, C:\cygwin, to some other path. Doing so keeps the Cygwin files separated from your native Windows files"


Perhaps if it's default installation path was c:\windows, I would be worried about this....*perhaps*. What the hell is going to be in c:\cygwin that comes with a default windows installation?

the only other way a 'conflict' like this could occur would be if there was a windows binary called, for arguments sake, "a.exe", in c:\windows, and cygwin installed a file called "a.exe" too - but this would be an issue wherever cygwin was installed, because it would still be in your %PATH% and still conflict with the original windows binary.

so wtf?

I think benefit of putting it

Anonymous's picture

I think benefit of putting it on different partition than windows drive, is that cygwin binaries won't fill up your system drive.
There are softwares out there which install some part of it on windows partition. (You don't get choice here) So when software lets you specify a path, one should choose non-windows drive.


Anonymous's picture

That's what I was talking about

the writer probably meant par

Anonymous's picture

the writer probably meant partition separation. As in:
Disk C - use it for system
DISK D - use it for programs
DISK E - use it for other data.

So that if (when - hehe) win stops working you just format disk C and reinstall this increadible superiour system called windows again.



gcheves's picture

That's great advice about having a partition just for the system because I had two hard-drive crashes when I was running Win98 and I learned that lesson the hard way.

I used to use Cygwin for logging-on to SSH sessions at school to run oracle programs. I found it very useful for learning Linux commands and editing files in VI, VIM and EMACS. But I got the most mileage out of it running C++ programs on Cygwin rather than going to the lab or logging-in remotely.

I've stopped using it now that I found out about Putty for SSH and Secure iXplorer, which is a Putty SSH client, for secure file transers.

Installing programs to a

Anonymous's picture

Installing programs to a separate harddisk/partition is stupid. Data, sure, but programs? When windows crashes/corrupts (and it eventually will) the registry goes with it. Then what? You reinstall the system and have to reinstall the programs anyway. Might as well install the programs to the same partition as the system.


Anonymous's picture

Cygwin is great.

I think you absolutely want to use rxvt (included in cygwin) instead of the native cmd.exe like bash window. rxvt works even without the X server - it has a native Win32 mode for cygwin.

I agree, though, that cygwin will not make your Windows box an unix box. Services/dameons work much less reliably, and things are shaky at times. But it does make your life much more pleasant in Windows environment.

Cygwin and expect

Charles Stepp's picture

The REAL mindblower for me was that expect works under cygwin. THAT has made my corporate windows laptop very powerful indeed...and just today I learned about rlwrap. I've used it to put command line editing into Oracle's piddling sqlplus. FANTASTIC!! Worth every penny I didn't have to pay.

I'd gladly cough up $100 for cygwin to keep the maintainers fed.

Re: rxvt...

Anonymous's picture

rxvt is OK, but xterm is much better. I run bash in an xterm and it makes Windows almost tolerable.

Your absolutely right about c

Anonymous's picture

Your absolutely right about cmd.exe. It's bad. :-)
I'm using this one in stead of rxvt. I think it's even better:

It's the same terminal as putty uses. I have always found that one to be really good.



Charles Stepp's picture

Very nice...unset the display, make it go full screen and run aafire.


Anonymous's picture

You can get a lot of this functionality without fulling installing Cygwin by using the XLiveCD. This is set of packages and scripts designed to run Cygwin from the CD, so you can test out this type of environment before commiting to a full installation. It is also useful if you are in an environment where you can't install software on the host machine.


Anonymous's picture

You can get a lot of this functionality by Cygwin using the Winik CD. This is set of packages and scripts designed to install Cygwin from the CD, so you can commiting to a full installation without hassle. You can test out this type of by using XLiveCD environment before commiting to a full installation.