BASIC X-Windows



X-Windows

Background and Terminology

In the Microsoft Windows world there are two basic approaches for GUI access to a remote system – “remote control” where a user accesses an existing remote desktop shared with another user (VNC, Dameware), and “remote desktop” where the user actually gets a unique “virtual desktop” via separate login – (Windows RDP, Citrix/ICA).

XWindows, the LINUX/UNIX GUI is a slightly different animal. In XWindows, the GUI (screen manager) is separate from the desktop manager (GNOME or KDE for LINUX). As a matter of fact, XWindows need not manage a remote desktop at all. It can run remote Xwindows applications to interface with a local desktop. To put it another way, XWindows separates screen/mouse/keyboard device management from the GUI desktop or application.

LINUX supports all 3 approaches. VNC has been in the LINUX for several years, Windows Remote Desktop support was introduced into Fedora Core, and XWIndows support has been there since Day 1.

XWindows also stands the typical client/server relationship on it’s head. The GUI is the “server”, requesting execution of the remote “client” program. The remote client program can be an XWindows application (Xclient if you will) running on the local desktop or it can be a local or remote desktop.

Common XWindows Terms

The X Windows Server

The X "server" is the machine that is responsible for managing the screen, mouse and keyboard. It's called a server because it "serves" graphics. In LINUX and UNIX, the Xserver is usually “X”.

The X Windows Client

The X client is the machine that runs the programs that use the X Windows server. This is where the real work gets done. Examples are xterm, xclock etc. or a desktop manager.

The Display

X Windows allows a server to have more than one display. This is sometimes used to create multiple virtual desktops that you switch back and forth between, and sometimes to support several physical monitors. Displays have names like 0.0, 1.0, and 0.3. "0.0"is used most often representing the main display for the server.

Desktop Manager

Any “Windows Manager” that presents a desktop – KDE, CDE (UNIX), GNOME, TWM, FWDM.

X Terminal

Any machine running an XWindows Server

X Application

Any application that will speak to a XWindows terminal/server.

Local XWindows Desktop Management

“Out of the box” most LINUX/UNIX systems have XWindows setup properly for the local desktop manager – GNOME and KDE for LINUX. This is the default if the inittab, inidefault runelevel is set to 5.

Start XWindows?

The basic XWindows server command is “X” . To start the local desktop (usually if in runlevel 3), type in: startx (gnome) or startkde (kde), which are front-end scripts to the xinit command.

Exit Xwindows?

To get out of XWindows, press these 3 keys (runlevel 3 only, runlevel 5 will respawn Xprefdm):

Ctrl Alt Backspace

XWindows and Virtual Consoles

In GUI mode, you access text virtual consoles by pressing these 3 keys:

Ctrl Alt F1 – Virtual Console 1

Ctrl Alt F2 – Virtual Console 2 …etc up to 6 virtual consoles (by default)

Multiple XWindows and Virtual Consoles

If you start another GUI desktop from virtual console, use this command

startx -- :1 that GUI is assigned to the next non-text virtual console # - VC7 by default – and is accessed by pressing these 3 keys:

Ctrl Alt F7 – Virtual Desktop 1 (default)

Ctrl Alt F8 – Virtual Desktop 2 …etc up to 6 virtual consoles (by default)

startx and .xinitrc and .xserverrc

startx is a script front end to the xinit command – the local Xwindows manager. The xinit format is:

xinit [client] options] [– [server] [display] [options] ] … note two dashes between client and server

xinit uses file $HOME/.xinitrc to start specific X client programs. If .xinitrc doesn't exist, the default program is xterm :0. All X programs are run in the background (&) except the last which is the desktop.

This desktop is run with the command:

exec

where is the command that starts the window default windows manager you want to be your default.as the last line in the file. Most common window managers and desktop environments are:

• KDE = startkde

• Gnome = gnome-session

• Blackbox = blackbox

• FVWM = fvwm (or fvwm2)

• Window Maker = wmaker

• IceWM = icewm

• tvwm

xinit uses the $HOME/.xserverrc file to specify server options. In the absence of this file, the default is:

/usr/bin/X :0.0.

Remote XWindows Application Management

XWindows is the Server/Client model – in reverse. The GUI is the server, the application is the client. Most Xwindows applications are local (Gnome or KDE local desktop). Sometimes we need to use an X client which needs to be run from another machine.

The general procedure for setting up a remote XWindows app is:

1) Determine the display on the local host (server) – who or echo $DISPLAY

2) Set the display on the remote (client) host. export DISPLAY= or setenv DISPLAY=

3) Set the security on the local hostto accept input from the remote client with the xhost command:

xhost +

4) Start the XWindows application on the remote host: xterm, xclock, etc…

Example: you are logged into marie (local machine - server) and want to run xterm from arthur (remote machine - client):

A. Determine the local display name on marie, go to a shell prompt on marie and issue the command:

echo $DISPLAY

The response should something look like:

csc.oakton.edu:0.0

If you just get a blank line then type:

who

and look for your username:

user1 /dev/pts1 Sep 17 13:16 (marie.oakton.edu:0.0)

The last item will be your display name or it may be an address:

B. Make Marie’s display known to arthur, LOGIN to arthur and issue the command:

export DISPLAY=marie:0.0 (bash) or setenv DISPLAY marie:0.0 (csh)

If you are at the console of marie (ie. in front of the computer itself ), then the display is called marie:0.0.

C. Authorize arthur to write to marie, in marie type: xhost +arthur

to which marie will reply: arthur being added to access control list.

D. Run any X client from arthur and display it on marie display: xterm, xclock.

NOT twm, startx, startkde etc. Attempt to start a remote desktop will fail.

E. You can also run an Xwindows program directly from arthur without setting the environment variable using the –display option: xterm -display marie:0.0 &

Either way, place the XWindows app in the background with & on arthur.

F. You can bypass steps 1-3, using SSH with the –X flag to pass the graphical request in a encrypted tunnel:

ssh –X user@arthur

Enter password:

xterm &.

Remote XWindows Desktop Management

Most persons are used to the remote control or remote desktop scenarios Microsoft Windows provides. The above procedure provides neither.

To get a remote login using a GUI, you must make use of two different XWindows tools – xdm (XWindows Device Manager) and xmdcp (XWindows Display Manager Control Program). xdm on the client provides for controlling the remote XWindows device (terminal/server) and uses definitions to present a specific desktop application using a secipt called Xprefdm.

Because xdmcp is inherently insecure, remote access to xdm is usually shipped turned off (local desktop only). The process to get a remote desktop is 1) turn on remote access to xdm, 2) point the local XWindows server to the xdm client using xdmcp. Xdm configuration files will vary among LINUX/UNIX flavors. So does setup Consult your specific technical reference for that OS release.

1) For LINUX, the GNOME equivalent of xdm is called gdm. Gdm has a configuration file /etc/gdm/gdm.conf (or custom.conf) that has very nice GUI configuration application gdmsetup that can run as a XWindows application. It can even be run remotely as sp specified above. Gdmsetup was not apparently shipped with Fedora Core 9 or 10.

A sample gdm configuration file follows. Note the critical parameter is the enable=true in the [xdmcp] section. This allows xdmcp response on UDP port 177.

[security]

DisallowTCP=false

AllowRemoteRoot=true

[xdmcp]

Enable=true

[gui]

[greeter]

Browser=true

Include=user1,root

IncludeAll=true

[chooser]

[debug]

Enable=true

#

[servers]

1=Standard

#

[server-Chooser]

name=Chooser server

command=/usr/bin/Xorg -audit 0

chooser=false

handled=true

flexible=true

priority=0

2) The second step is to point XWindows server to the xdm/gdm client: X –query marie

If you have a graphical login and xdm as your display manager, you may change the default window manager by changing text file $HOME/.xsession.. Contents are the same as xinitrc, only the file name is different. After editing .xsession and saving the changes, your new window manager starts up the next time you log in via xdm.

Summary

Xwindows can be confusing to the newbie. Just remember that Xwindows is a split client/server in reverse. Relationship among commands and files are as follows:

1) startx -> xinit [client] [option] [--] [server] [display] [options]

client = x program – xterm (default) xclock etc or desktop manager like gnome or kde

server = /usr/bin/X or Xsomedisplay

display = :0.0 (default) : 1.0 etc

$HOME/.xinitrc specifies the defalt client settings

$HOME/.xerverrc specifies the default server settings..

2) If you start the system in runlevel 5, you respawn the Xwindows server with the command /etc/X11/prefdm ... or something similar. Which is why the Ctrl Alt Backspace doesn’t put you into text mode.

3) For remote Xwindows login, a separate X device manager (xdm/gdm) is started on the client and remote xdmcp access (UDP port 177) is allowed by specifying:

[xdmcp]

enable=yes

in the appropriate xdm configuration file (varies by OS distro).

Then from the X Server you connect to the remote client xdm with the command:

X -query

The -query flag forces an xdmcp connection request to be sent to the remote client xdm.

Trouble shooting tips:

To get out of XWindows press these 3 keys: Ctrl + Alt + Backspace

Note this doesn’t work for local systems at runlevel 5 where the GUI/XDM process is automatically “respawned”.

Check Desktop managers in the system prefdm script.

Make sure the remote xdm is set for xdmcp enabled (or scan for UDP port 177)

If the desktop doesn’t start properly after remote LOGIN, check the $HOME/.xinitrc or

$HOME/.xsession files of the logged in user. This contains the script determining which desktop

manager to use.

If the remote desktop starts but the local display looks wrong (or blanks the screen), check the video

setting of the remote xdm using Xconfigurator on manually editing files such as $HOME/.Xsession.

Or as root, check the /etc/X11/xorg.conf file settings for monitor if you are using Fedora or use the

XF86Config command for older versions of RedHat.

Be careful of the Horizontal Sync and the Vertical Refresh rate on the monitor settings. iIf you get either one of those specs wrong you can possibly destroy your monitor; so be careful and start with the lowest sync rates and resolution values possible..

If you get an error message:

X11 connection rejected because of wrong authentication.

This usually means problems with the .$HOME/.Xauthority file that restricts Xwindows access.

Check man pages for .Xauthority, xauth or mkxauth commands on the xdm machine for resolution

procedures.

If the desktop still doesn’t start properly, check the options $HOME/.xxxxxxrc file, where xxxxxx is the

run control file for the selected desktop: .twmrc or .fvwm2rc

The XWindows files that you should be aware of and likely use:

- XF86Config = the configuration file you may spend time editing

- SuperProbe = video clock probing

- Xconfigurator = configuring X manually. Usually for video or mouse setup.

- system-config-display when using Fedora

- drakconf or harddrake2 when using Mandrake

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download