This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: launching a remote webbrowser with cygwin
- From: Andrew McRae <anm at pobox dot com>
- To: Chris Bullock <cgbullock at cox dot net>
- Cc: cygwin-xfree at cygwin dot com
- Date: Wed, 24 Mar 2004 09:46:30 +1200
- Subject: Re: launching a remote webbrowser with cygwin
- Reply-to: cygwin-xfree at cygwin dot com
(Apologies; most of this message is really not very Cygwin-specific.)
Chris Bullock wrote:
> What I desire. I wish to load a very small portion of Cygwin on each
Windows
> box. When the user clicks the icon it would then connect to the Linux
> Terminal Server and launch $browser of choice. First off is this
possible?
> and if so can someone point me on how to make this happen. I do not
want to
> have to run the entire terminal client. Currently, what we have
tested is
> from the cygwin prompt we run 'X --query $LTSP:1' but this gives us
the
> entire terminal server and all I want the users to do is access a
webbrowser.
That's a slightly odd command line: I would expect you to be saying
X -query <hostname>
Anyway, the "-query" argument tells the X server that you are launching
to talk to the display manager on the remote host. Usually, the display
manager pops up some kind of authentication dialog, and when the user
is authenticated, it starts up the user's session. In your case, it
sounds like the user's session is a whole desktop environment (perhaps
GNOME or KDE?), and that's what you don't want.
(For reference: the X server contacts the display manager using the
XDMCP protocol; the display manager is also an X client, so once the
connection is made it can display things back on the X server.)
So it's important to understand that you're already running just the
part of Cygwin that you need -- the Cygwin X server -- and that all the
other stuff that you see, and don't want, is running on the Linux
machine.
There are a couple of different ways you might like to handle the
problem.
----
1) One approach is to change things on the Linux box so that a user's X
session just runs an instance of the web browser, not an entire desktop
environment.
How to do this may depend on what display manager / desktop environment
you're using. The "traditional" X display manager is "xdm". If you're
running GNOME, you're probably using "gdm". If you're running KDE,
you're probably using "kdm".
In each case, though, the display manager ends up running a shell
script to start the user's session. Usually, the last thing the shell
script does is to launch a "session manager", which handles starting up
all the programs that make up the user's environment.
For example, xdm runs a script called "Xsession" to start the user's
session. The "Xsession" script looks for an executable file named
".xsession" in the user's home directory. If that's not present, it
runs "xsm" (the "traditional" X session manager). So under xdm, to make
a user's session contain just an instance of their web browser, you can
set up a ".xsession" script in their home directory that just runs the
web browser. (And to make that change for all users on a system, you
could modify the "Xsession" script.)
Sorry, I don't have a GNOME or KDE system to hand to give an
appropriate example; I'm pretty sure that gdm uses ".xsession" in the
same way; I would guess that kdm does as well.
----
2) Alternatively, you could arrange for your users to specifically
invoke the web browser. The obvious way to do this is with SSH. Once
the X server is started, and the DISPLAY environment variable is set
appropriately, they could run
ssh -f -X <hostname> mozilla
to run the Mozilla browser, as an example. As long as X forwarding is
allowed on the server (option "X11Forwarding") this will start an
instance of the browser on the remote machine that thinks it's talking
to an X server on the same remote machine, but SSH will forward the X
traffic back to your local X server.
(The "-X" option may be unnecessary depending on your SSH client
configuration. The "-f" option puts the SSH process into the
background, which is probably what you want for interactive use but may
not be what you want in a script.)
So the process that you need there is: start the X server, wait until
it's running and ready to accept connections, and start a client. The
"xinit" and "startx" programs (see their man pages) are designed to
automate this kind of process.
----
Hope this helps,
Andrew.