Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Introduction to XFree86 4.x

Chris Houser (chouser@gentoo.org), UNIX programmer

Chris Houser, known to his friends as "Chouser", has been a UNIX proponent since 1994 when he became the computer science network administrator at Taylor University in Indiana, where he earned his Bachelor's degree in Computer Science and Mathematics. Since then, he has gone on to work in Web application programming, user interface design, professional video software support, and now Tru64 UNIX device driver programming at Compaq. He has also contributed to various free software projects, most recently to Gentoo Linux. He lives with his wife and two cats in New Hampshire.

Chris welcomes your questions and comments on this tutorial. You can reach him by e-mail at chouser@gentoo.org.

Summary:  This tutorial shows you how to get XFree86 4.x, the standard free X server for Linux®, up and running on your system. Chris Houser steps you through the process of getting X configured to work properly with your hardware, and getting X running using your preferred resolution and color depth.

Date:  31 Oct 2001
Level:  Introductory PDF:  A4 and Letter (75 KB | 21 pages)Get Adobe® Reader®

Activity:  6712 views
Comments:  

Remote access and authentication

Remote access introduction

Unlike many graphical user interface systems, the X window system was designed with remote access in mind. It is simple to run an X client on one machine and have its windows display and be controlled by an X server running on a different machine.

To work through this section of the tutorial, you will need access to at least two different UNIX machines connected to the same network, with XFree86 installed on both. We will refer to the one you sit in front of as the Server Machine; the other will be called the Client Machine. Although both need to have X installed, only the Server Machine needs to have been configured as described so far in this tutorial. Also remember that you must not have "-nolisten tcp" in your startx script on the Server Machine. The Client Machine must have X libraries installed, but the X server need not be configured or running. In fact, the version of X installed on the Client Machine doesn't even need to be XFree86 -- any modern X implementation will do.

Get server hostname and display number

To get started, open an xterm (or other terminal emulation program) on your Server Machine's desktop, execute the following commands, and note the output. We'll be using this output in the next few steps.

$ hostname
servermachine.foo.bar.net
$ echo $DISPLAY
:0

You should already be familiar with the hostname command, but the DISPLAY variable may be new to you. When XFree86 starts up, it takes a display number, usually 0. We'll see how to use this display number in a minute.


Generate a new .XAuthority file

Next, you may have to generate a .Xauthority file, if you don't already have one. To find out, use the xauth command:

$ xauth list
xauth:  creating new authority file /home/c/.Xauthority

If you do not see this error message, and instead xauth lists one or more authentication lines, then you should skip this next step. An authentication line looks something like this:

servermachine/unix:0  MIT-MAGIC-COOKIE-1  39849ced20eb2b62df87c714a251b8fc

If you did see the creating new authority file message, then you need to generate a new authentication key:

# xauth generate .


Shared home directory

Now, the easiest way to get a remote program's window to show up on your Server Machine's desktop is if your user's home directory is the same on both machines. This is often the case on local UNIX networks when users' home directories are mounted from some central file server via NFS or some other network file system. If this is the case with your Server and Client Machines, all you need to do is tell the Client Machine where to find your X server, covered in the "Set your DISPLAY" section ahead.


Extracting the authentication entry

However, if the two machines do not share your home directory, you'll have to do a bit of work to give your Client the authority to talk to your Server without opening up access to the whole world. To do this, you'll need to copy the authentication entry you created earlier (or one that already existed) to your remote Client Machine. First, you must extract the entry from the Server Machine:

$ xauth nextract myauth.xa $DISPLAY

Now the file myauth.xa contains your X authentication data; you should be careful not to leave this file lying around were other people can see it, or to transmit it unprotected across public networks. You do need to copy it to your home directory on the Client Machine, so I would recommend using scp (part of the ssh package).

$ scp myauth.xa clientmachine:myauth.xa
$ rm myauth.xa


Merging the authentication entry

Next, log into your Client Machine using rlogin, ssh, telnet, or whatever you normally use to access the other machine. Then, merge your copied authentication entry into the .Xauthority on the Client Machine:

$ xauth nmerge myauth.xa
$ rm myauth.xa


Set your DISPLAY

Your Client Machine still needs to know where to find the XFree86 server you are running. Tell it by setting the DISPLAY variable to point to your Server Machine. Make sure you are logged into your Client Machine, and use the hostname and display number you printed earlier. If you're using a Bourne-like shell, do this:

$ DISPLAY=servermachine.foo.bar.net:0
$ export DISPLAY

Otherwise, if you're using a csh-like shell, do this instead:

$ setenv DISPLAY servermachine.foo.bar.net:0

As you can see, we used your Server Machine's name, with the display number tacked on the end.


Run xeyes remotely

Now you are ready to run a program on the Client and control it from the Server Machine:

$ xeyes

You should now see a large pair of eyes (with an unhealthy interest in your mouse pointer) pop up on your screen. This program is running on a remote UNIX box (your Client Machine), and yet is interacting with your mouse and display on your local workstation (your Server Machine). To make xeyes stop, just quit the xeyes program that's running on the Client Machine by typing Ctrl-C in the terminal emulator window. The eyes will then immediately disappear from the display on your Server Machine.


Conclusion

You have now seen most of the many facets of XFree86 configuration. You've worked with several different configuration files (XF86Config, startx, xinitrc, .Xresources, .Xauthority). You've changed remote access and authorization settings, and gotten XFree86 driver settings set up correctly. You should now have the tools you need to take control of your X windowing environment and master your UNIX desktop experience.

6 of 8 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux
ArticleID=133093
TutorialTitle=Introduction to XFree86 4.x
publish-date=10312001
author1-email=chouser@gentoo.org
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.