Using Linux on Windows with Cygwin
Secure Tunneling
Cygwin also lets you set up a remote desktop session through a secure SSH tunnel. First type X &
at the Cygwin console to open a local X server. (The &
sends the service into the background and ensures that you can continue using the console.) This command calls the X binary directly. The X server starts in a large window, with no terminal for setting up an SSH session. This approach helps you avoid closing the wrong window in the desktop environment and thus terminating all open applications. After opening the X window, go back to the Cygwin window and run the following command to launch a KDE desktop environment remotely:
DISPLAY=:0.0; ssh -Y -f \ <IP-of-Linux-PC>; startkde
After setting DISPLAY
, you need to run an SSH call that again releases the console after executing a command on the remote host (-f
option). The -Y
parameter initiates X forwarding in trusted mode, so the window manager can use the X instance remotely.
For Xfce, replace startkde
with startxfce4
; and for LXDE, use startlxde
. Gnome 3 proved problematic in our lab with the gnome-session
startup command: The desktop environment failed because of the lack of 3D support. A general method to enforce fallback mode over the network does not seem to exist.
Native Everything
Another option is to install a ported desktop environment (or at least a window manager) locally in the Cygwin environment. The desktop offers the look and feel of Linux – for remote applications, but also for locally installed ports. The standard Cygwin repository lets you install Windowmaker and the FWM and Twm window managers. Gnome, KDE, LXDE, Mate, ROX, Xfce, and the Sugar desktop environment are all available as Cygwin ports [5].
I tried to install KDE, and the libqt4
dependency turned up missing. Although libqt4
is available in the normal repositories, it is not provided in the Cygwin Ports version. To resolve the problem, I needed to restart the installer and integrate the appropriate package. After this step, I managed to launch a KDE desktop in the Cygwin environment (Figure 5), but only after a relatively long startup time.
The Gnome shell was not available on the server, so I was unable to launch the Gnome desktop. The spartan Windowmaker environment (Figure 6) worked out of the box, however. The download volume is fairly small, and Windowmaker is included in the standard Cygwin repository.
The startx
startup script is also used in the Cygwin environment to launch X plus a display manager. The following command opens a KDE session:
$ startx /usr/bin/startkde -- \ -nodecoration
The start scripts for the other desktop environments are the same as for the remote calls. Before you launch any other programs, you need to set DISPLAY manually. The "Starting the Cygwin X Server" box gives more details. The Cygwin Installer also offers a graphical user interface named XLaunch, which removes the need for users to enter the command lines described in the box to users (Figure 7).
Starting the Cygwin X Server
Typing startxwin
in the Cygwin console or selecting the menu item created by the installer starts the X server in multiwindow mode (one window per application with Windows window dressing).
Without parameters, the tool – which replaces the startxwin.sh
and startxwin.bat
scripts of earlier versions of Cygwin – opens an Xterm window with the DISPLAY
variable set. You can log in directly by typing
ssh -X <IP-of-Linux-PC>
and starting graphical programs remotely. The command-line parameters for startxwin
and its configuration file ~/.startxwinrc
are explained in the tool's man page [8].
XWin.exe or X
A call to X
only starts the X server; you launch programs that access the server at the Cygwin console after setting the DISPLAY=:0.0
shell variable. The Cygwin X server parameters differ in part from those of the Linux version and are described in the man page [9].
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.