I have an Ubuntu server running gdm with graphical user session in it. I also have an open ssh console from remote host on that server.
I want to run x windows application from that remote console.
export DISPLAY=0.0
xclock
Error: Can't open display: 0.0
How can i do that without restarting gdm and enabling remote connections with xhost +, is there any way? Can't i use local named pipes to connect to display server?
The display property needs a leading ':'. The whole notation is actually host:displaynum, but the host part can be left off if you want it to show on the localhost. However, the colon can't be left off. So ":0.0" is the value you likely want (and ":0" will likely work too).
When coming in from a remote host, actually the easiest thing to do (because it takes care of X authentication and secures the X connection) is to have ssh handle the X screen forwarding and environment setup for you. You can do this with the -X switch:
ssh -X remotehost.example.com
After doing that you can examine the DISPLAY variable and you'll see it'll be something like :10.0, because it's actually port-forwarding the remote X display port to the local display.
In the X-Windows session, bring up a terminal and type
Then run your commands in the remote SSH terminal:
That should work correctly.
You'll need to run the command you want to display as the same user who is logged in. In the case of having
gdm
running, that would be root.If you want to allow all other users on the local machine to use the display, run this as the display's current user:
(nothing after the :)
This could be an issue if there are other users which you do not want to allow to use the display. In this case, you need to use
xauth
for more fine-grained control.