Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is making me frustrated. Why doesn't it work, and how do I get it to work?

I have a newly installed Ubuntu 10.04.2 (Lucid Lynx). I have installed X and gdm. Gdm is set up to automatically log in a user. The computer does not have any keyboard connected, but I want to display some stuff on its local display.

Normally, I would just ssh to the computer as the user who has logged in automatically, and run "DISPLAY=:0.0 xclock", for example.

But now I only get the response:

user@host:~$ DISPLAY=:0.0 xclock
No protocol specified
Error: Can't open display: :0.0

However, if I log in as root, it works.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

There seems to be a couple of bugs involved in this problem: This one prevents an .Xauthority file from being created. And this one prevents the proposed workaround from working when using an automatic login.

So the solution was to change the automatic login to a timed login with a short delay, and add the following to /etc/gdm/PostLogin/default

#!/bin/bash

auth=$HOME/.Xauthority
if [ -e $auth ]; then
diff <(xauth extract - $DISPLAY) <(XAUTHORITY=$auth xauth extract - $DISPLAY) > /dev/null && exit 0
fi
xauth extract - $DISPLAY | XAUTHORITY=$auth xauth merge -
chown $USER $auth
share|improve this answer
    
Or just run 'xhost +localhost' as the user who is logged in on the machine before starting the X client. –  symcbean Apr 1 '11 at 11:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.