Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I'm logged on to another host (e.g via ssh), how do I connect to the XServer of that machine (same user is logged in and is running a desktop (gnome))?

You may ask way I wish to do that: There are commands that don't open an X-Window, e.g. xinput, xhost, etc.. and there are situations where you want to run them from remote.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

I found the problem. Setting DISPLAY manually to localhost:0 is not working, because the XServer does not listen to TCP connections (default Ubuntu 10.04 configuration).

However, setting

export DISPLAY=:0

does the trick.

share|improve this answer
add comment

You will need to set your display environment variable in the ssh session. Most likely, the X server is running on display 0. So in the ssh session (assuming a Bourne-like shell), type:

export DISPLAY=localhost:0
xclock

You should see the clock on the remote X server display.

Note: this should "just work" if your ssh session is logged in as the same user that started the desktop session on the X server. If you are logged in as a different user, you may need to obtain the xauth cookie from the desktop session's user account.

share|improve this answer
    
This did not work for me. However, export DISPLAY=:0 is working fine. I think, the Xserver does not listen to TCP connections by default (Ubuntu 10.04). Without the localhost a unix socket is used. –  IanH Jul 31 '10 at 16:56
add comment

If you are using the command line ssh, and assuming you are using Linux:

ssh -X host

Then try something like:

xclock

And you should see a clock but it is being ran on the remote computer.

Note: This will only work if x forwarding is turned on in the sshd config file.

Of course this is just a quick overview - can you post more info like what OS you have and what SSH client you are using?

share|improve this answer
    
Sorry, but I don't need X11 forwarding. If I would ran ssh with X11 forwarding and I enter xinput, I 'll get the list of the x-input-devices of my LOCAL computer, but I want to get the ones from the remote. –  IanH Jul 31 '10 at 14:42
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.