acpid script can't connect to X Server in FC4

Mikkel L. Ellertson mikkel at infinity-ltd.com
Wed Feb 8 17:51:58 UTC 2006


frederic.bauchet at voila.fr wrote:
> On my thinkpad T23 I use hotkey Fn+F3 to switch off screen on a Fedora Core 4 with ibm-acpi module.
> 
> The script is :
> export DISPLAY="localhost:0.0"
> xhost +
> xset dpms force off
> 
> Into /var/log/acpid I get the followind logs :
> _X11TransSocketOpenCOTSClient: Unable to open socket for tcp
> _X11TransOpen: transport open failed for tcp/localhost:0
> xhost:  unable to open display "localhost:0.0"
> _X11TransSocketOpenCOTSClient: Unable to open socket for tcp
> _X11TransOpen: transport open failed for tcp/localhost:0
> xset:  unable to open display "localhost:0.0"
> 
> I have enable the tcp socket of the X server with gdmsetup and the X server is listening on port 6000.
> 
> If I use the same script as root, it works fine.
> 
> Dos anyone have already resolved that kind of problem ?
> 
> Thanks in advance for your help
> 
> Frédéric
> 
> 
You can not run "xhost +" from a script unless the user running it
can already connect to the X server. The script would probably work
if you ran it in an xterm as the user logged in at the console. It
would also work if you ran "xhost +" from an xterm before the script
is run. But be aware that this is a big security risk. A somewhat
less risky way would be to run "xhost +localhost", as this would at
least limit connections to programs running on your computer. (But
anyone logging into your computer using ssh could connect to your
X server.)

You really need to look into xauth to let the acpid scripts connect
to the X server.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!




More information about the fedora-list mailing list