SSH: Gtk-WARNING **: cannot open display: :0

Hi,

I’ve used multiple operating systems; Fedora, Debian and Ubuntu and with them all I have installed and worked with SSH. I recently started to look into openSuSE just to get a flavour of using it day to day. My problem is the following with SSH:

I have a computer and a server (in my tests there is someone logged onto the Server). I SSH into the server (as the user that is logged into the Server) and try to get Zenity to display a dialog on the server. In the other flavours I have used I just use:

export DISPLAY :0

Then called Zenity, but I get Gtk-WARNING **: cannot open display: :0.

Running ‘who’ shows that the user logged onto the server is running under display :0 so I am not too sure what the problem is. Any tips or hints would be greatly appreciated.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have no idea why that would ever work… that’s not a valid export
statement:

export DISPLAY=:0.0

Your statement would only export an existing DISPLAY variable (if set)
and would probably just fail on the last :0 parameter.

Good luck.


Want to yell at me in person?
Come to BrainShare 2011 in October: http://tinyurl.com/brainshare2011
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOfKQ2AAoJEF+XTK08PnB5LP4P/2u5KtcrEBFKEilx4NOGOzGx
MMKz0V7+MJAGRXgEBeWYkxFqYHOkOxpbFKKNVo6/czTfyBeSDpogXmvgswutpDvN
Uqc/Zd0N0AtGfpUbsLD1zXJkN06TporuVB9zQQZ1+fQ00WNv4erUyHi+W+rjRRXr
loABrIAtze9RxaTIOLscXzHtvc44GsoQbcP53O1Aztc8t7dVoZ9TRqUwKeaJX9CR
pHXg+dKfhuUN1JnFek+xTicW+lVexGOsdCvlN30eGBrH0Eq7vGYUAL4Zzm1sZeZm
k+Sz2pCaiZc14FB9+NOg5EB62zAB4kAkYna+Ad6XfbLZCsJABJqcbk1BQEzt8E6M
y99mWWbgmly4WkUDP3xFfzh6hSUYJOjKNGGshZxviRW730jW7xBvmymgljue9hPh
pxsWm9LfqP8w2MGJCy3p2gBHot8OgSDMIx0JNHGsK26YTkFCT/lCO9iFWESHIAYT
jQI+ZUNLGjmVFAnf4G58QRVXBKWZcV016fr8NoUyH8vjmidqrfJDbOLZMykOsvw+
MSmSiQsAfTHcvq9QOLOGoUCH6VS2GQkGT//8blnZ38yHdurmoEjds1McLwdiU9NJ
IhtJKOQEXe+3RuTx9TS2mjPqLwgNlT2QnQZat9LA3F5agFmAPCTt2IJl1E73H8KV
mDREXHkjQ8e7+GojDkIk
=Vz+L
-----END PGP SIGNATURE-----

To use X requires that the X authentication works.

If you are using gdm as display manager, then it does not use $HOME/.Xauthority. Instead, it has a file elsewhere and sets XAUTHORITY to be the path to that file. Your SSH session probably does not have that definition for XAUTHORITY. You either need to export the xauth information to your “$HOME/.Xauthority” file, or define the needed value of XAUTHORITY in the environment.

I have found that in some circumstances, I also need to define XAUTHLOCALHOSTNAME in the environment.

Hi,

Thanks for the replies.

@ab - sorry in my haste to type (rather than copy and paste which I should have done) I did indeed mean export DISPLAY=:0.0

@nrickert - thanks. do you have any links that I could read to increase my knowledge of ssh and xauthority so that I can understand what I need to do and then how?

Try


man xauth

If you switch display manager from “gdm” (which you are probably using) to “kdm”, that might already solve your problem. However, that might interfere with opening the default gnome keyring when you login (mostly a problem for WiFi, I think).

Hi,

“man xauth” - lol, should have thought of that :slight_smile:

Anyway thanks for the help its working now. I had to modify my script to find the xauthority file of the user logged in and then as you said: export XAUTHORITY=<path to xauthority file>/database and voila the dialog appears on the other machine.