interview question and answer

June 24, 2012

Use xming, xshell to display linux gui to windows desktop (x11 forwarding) -

Use xming, xshell to display linux gui to windows desktop (x11 forwarding) -
Firstly, download xming, install it on your windows pc system.


You can go to http://sourceforge.net/projects/xming/files/ to download.

Let’s assume that you want to run xclock on solaris/linux server 192.168.0.3, and want the gui display on your pc whose ip is 192.168.0.4.

After installation xming on your windows, log in linux/solaris server 192.168.0.3. Set environment variable DISPLAY to the ip address of your windows, and append a :0 to it:

#export DISPLAY=192.168.0.4:0

Then you must allow X11 forwarding in sshd configuration file. That is, set X11Forwarding to yes in /etc/ssh/sshd_config and restart your sshd daemon.

After this, you need set 192.168.0.3(linux/solaris) to the allowed server list on your windows. Edit X0.hosts which locates at the installation directory of xming(For example, C:\Program Files\Xming\X0.hosts), add a new entry in it:192.168.0.3, the ip address of linux/solaris that you want to run x11 utility from.

Note: Thanks to linuxdict.com :D

Then, restart xming on your windows. And on solaris/linux server(192.168.0.3), run a X11 programe, like

#/usr/openwin/bin/xclock &

You will then see a clock gui pop up in your windows pc.

Amazing, isn’t that?

PS: Something from xshell x11 faq:(Actually, this step is not necessary to our goal)

Q:How do I run the X11 applications through Xshell?

X11 forwarding is a bit different from other TCP/IP port forwarding.

Please, go through the following steps.

1. To enable X11 forwarding service in Xshell: On the Tunneling tab of Advanced SSH Options dialog box, check Forward X11 Connections To. and select Xmanager if Xmanager is installed in your PC. If you use another PC X server, select X Display Location and enter the proper display name.

2. To enable X11 forwarding service in the SSH server: Setup the configuration file in the following table.

SSH server           Config file                          Setup

OpenSSH       /etc/ssh/sshd_config         X11Forwarding yes

SSH.COM    /etc/ssh2/sshd2_config      AllowX11Forwarding yes

3. To run X11 applications from the Xshell terminal:

1. If Xmanager is installed on your PC, just go to the next step. Otherwise, run the PC X server installed on your PC first.

2. Start the SSH connection with the session enabling X11 Forwarding.

3. At the shell prompt of Xshell, execute the X11 applications like the following examples:[nathaniel@intranet ~]$ xterm &

[nathaniel@intranet ~]$ startkde &

[nathaniel@intranet ~]$ gnome-session &

No comments: