problem to output to X with eog

Hello,

I successfully use to output images fullscreen with: “eog -f --display=:0 1.jpg” from a script to a GNOME desktop of openSUSE 11.3.
But on openSUSE 11.4 I get these errors:

linux-e2v9:~ # eog -f --display=:0 1.jpg
No protocol specified
Cannot open display: :0
Run ‘eog --help’ to see a full list of available command line options.
linux-e2v9:~ # eog -f --display=localhost:0 2.jpg
Cannot open display: localhost:0
Run ‘eog --help’ to see a full list of available command line options.

Here is how the X process is running on both systems, if this helps:
linux-e2v9:~ # ps -AF | grep X
root 1534 1489 0 32809 36476 0 00:09 tty7 00:00:09 /usr/bin/Xorg :0 -br -verbose -auth /var/run/gdm/auth-for-gdm-uZPcOL/database -nolisten tcp vt7

I’m not sure whether this is just a magic cookie problem of the user that is (auto-)logged in the gnome desktop. (this username is ‘robert’). I even tried now to log in with ‘root’ into the desktop - so that it is the same user - and also did not succeed to make eog display something on the desktop. It only works when I start a terminal window within the desktop and run eog from there. At the moment I develop the eog script from another machine that is logged into the openSuSE 11.4 machine with ssh.
I checked the $XAUTHORITY env directly on the terminal window (XAUTHORITY=/var/run/gdm/auth-for-root-iV3U2i/database) and set the env also on the root shell logged in with ssh from the development machine. eog still can’t display something to the display. I also tried “xauth merge /var/run/gdm/auth-for-root-iV3U2i/database” which wrote the cookie to /root/.Xauthority which did not exist before this. Now as it is there it still doesn’t seem to work to let eog display something to the xserver.

Any ideas? Thanks in advace,
Robert


Cannot open display: :0

seems indeed to point to trying to open on a (logical) display that is owned by another that has given no allowance (e.g. by xhost +) to use it.
Try


xhost +

from a terminal (on the display and of course as the user there) to see if it works then.

Trying as root is useless, because even root is not allowed to display on another’s display (remember that these actions are in principle remote, and thus user root on one system is of course not allowed being root on another system).

(BTW, pleasepost computer output here between CODE tags for the sake of readbility and to distinguis it from the rest of the post Posting in Code Tags - A Guide .

thanks for the hints in the right direction!

I had to:


XAUTHLOCALHOSTNAME=localhost
XAUTHORITY=/var/run/gdm/auth-for-robert-rb0XyW/database 
DISPLAY=:0
export XAUTHLOCALHOSTNAME
export XAUTHORITY
export DISPLAY
eog -f --display=:0 2.jpg

and edit /etc/sysconfig/displaymanager to change some default security behaviour.

also a sudo works:


sudo -u robert sh -c "DISPLAY=:0; XAUTHORITY=/var/run/gdm/auth-for-robert-rb0XyW/database; XAUTHLOCALHOSTNAME=localhost; export DISPLAY; export XAUTHORITY; export XAUTHLOCALHOSTNAME; eog -f --display=:0 /home/robert/2.jpg"

I don’t know whether I’ve done that the most elegant way, but it works!

Robert