| |
X11 Forwarding on Panther
One of the advantages of using X11 to build an application is the built in OS
support for X11 forwarding (remote windowing access). In this scenario, the
application runs on the remote host which generates the GUI commands, but the
actual windowing is done on a local machine. In a twist of semantics, the X11 window is displayed
by the X11 server. The application is considered the X11 client.
Yup, a bit confusing. Enabling remote windowing access to your Hello World
application is pretty easy. You can make it even easier by installing the xemacs
X11 text editor using FINK. Basically you need to set up the host machine to
accept connections using SSH, the secure shell. SSH
is built into Panther. Next you need to configure the SSH daemon to enable X11
forwarding. Finally, you need to connect over SSH from the local machine.
- To enable SSH, open the preferences panel on the host machine and select
Sharing. In the Sharing panel enable Remote Login under Services. SSH uses
encrypted communication between the host and local machine. Telnet is
inherently insecure and its use is discouraged.
- To enable X11 forwarding you need to edit the sshd_config file. Now be
careful. This is the daemon configuration file and is not to be confused
with the ssh_config file. You can do this from X11 by opening the file using
xemacs from xterm like this:
xterm>sudo xemacs /bin/sshd_config
Of course you can also do this with your favorite terminal editor such as
vi. On older systems the config file may live at /bin/ssh/. Now just
uncomment the line "# X11Forwarding no" and change it to
"X11Forwarding yes". Save the changes. Now when you restart the
host, X11 forwarding will be enabled.
- To run the Hello World application on the host you can do this from a
local machine:
>ssh -l hostusername hostIPAddress /pathToHelloWorldApp/HelloWorld
Unfortunately this tries to open the X11 window
on the host machine. Not want you want!
- To run the Hello World application on the host machine, but forward the
windowing to the local machine do this:
>ssh -X -l hostusername hostIPAddress /pathToHelloWorldApp/HelloWorld
The -X option enables X11 forwarding on the
local machine. Be careful. The -x option turns off X11 forwarding on the
local machine. Of course, the X11 "server" must be running on your
local machine. That's it! You can now manage your Hello World application
remotely using Panther's built in support for the remote secure shell and
X11 forwarding. And you can do this from most any Mac client running OSX,
Unix clients, Linux clients and Windows clients running X11. Theoretically,
the host does not even need to have the X11 "server" running since
all the GUI code executes on the local machine. Pretty cool!
- SSH runs on port 22. For security, any connection to
the Internet should pass through a firewall that disables port 22. Many
cable/DSL routers have a firewall that supports port blocking. When you
enabled remote login on the host, the firewall opened port 22 for remote
access.
- You can even run an Open Motif program remotely. The local windowing computer will draw the
widgets using the standard X11 drawing routines. There is no need to install
the Open Motif library on the local machine!
Have fun!
|