Support This Site burning void logo
 
Blogs:
Reviews
Site Blog
Writers' Exercises
Engineering Ardor
 
Resources:
Roleplaying
Writing
Cooking
Computers
Links
 
Cafepress Shops:
Stuff for Gamers
Caffeinated Chicanery
 
Admin:
Home
About Us
Contact Us
Twilight Time list
Site Update list

Sponsors:


(Your Link Here)
 
Text Link Ads
 
 
Search Now:
In Association with Amazon.com
 
 

Home --> IAQ -->

Connecting to Display :0.0

By Jeffrey Howard
All rights reserved unless noted otherwise

 

As a normal user, you can run X-Windows programs just fine. If you use su to become the superuser, X-Windows using programs fail, complaining that they cannot connect to display :0.0.

Platform

I've seen this behavior under various versions of Redhat's linux distribution. I do not know if others ship in the same configuration, but if they do, the same changes should have the same results.

The Rationale

First try to understand why the distribution ships this way. It seems incongruous, given that a superuser can read your files or delete them, kill your programs, boot you from the machine, change your password, etc. Why then, would you not permit the superuser to also run programs that connect to the display?

I would guess that the decision was made with a multi-user environment in mind. On multi-user systems, most users do not want other users to be able to access the display, even the root user. A common prank in college computer labs (during classes) is to break into the root account on another machine, then pop up something unusual while some poor student is trying to work. (Rumour has it that creative use of the xroaches program caused a Brown University computer science student to stand in the middle of the lab and shout, "There are roaches on my screen!")

On a single-user computer, there is considerably less concern that this kind of thing might happen. Nonetheless, it is better for vendors to make individuals relax security as they see fit. The alternative is to force other users to scramble to find all the holes that need to be patched.

The Solution

Edit your ~/.xinitrc file (or .xsession if you use runlevel 5). Add the line:

xhost +localhost

Exit X-Windows and re-open it. In essence, that line tells X-Windows to accept connections from anyone on the local machine. This is not necessarily a good idea if many people have access to the machine, but if you are the only user, it shouldn't cause any problems. If you don't wish to make the command a part of your default configuration, you can always use xhost just before you use su to switch to root.

jhoward@burningvoid.com

 
 
Google
 
Web burningvoid.com

This information is provided "as is," with no warranty or guaranty. The IAQ pages have not been maintained in some time; they're being kept up because, judging by the traffic and link-backs, people still find them useful.
Copyright 1998-2004 by Jeffrey Howard and Heather Grove, except where stated otherwise.