LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   local X server, remote application (https://www.linuxquestions.org/questions/linux-newbie-8/local-x-server-remote-application-425595/)

frankie_DJ 03-16-2006 10:05 PM

local X server, remote application
 
I don't know what exactly am I missing here, but I am pretty sure I am doing something wrong.

OK so I have two Linux computers (A and B) that are networked through the router and I want to be able to run X server on one of them with application from the other one. So, local Xserver, remote application. This is what I do:

1. On A: xhost +B
2. On A: ssh -X A (type in login and password)
3. On B, logged from A: export DISPLAY="A:0.0"
4. On B, logged from A: startx

When I do this, my Xwindows actually open on B, the remote computer. What am I doing wrong?

visaris 03-16-2006 11:17 PM

So, if I understand what you want to do, you want to be able to do this:

You are sitting in front of A, you want to log onto B with SSH. Then you want to run a program on B via SSH and see the window in front of you on A?

If that's the case you need to do this:
* Make sure the SSH server running on B has X11 forwarding enabled. Check the "/etc/ssh/sshd_config" file for this option. (If you had to enable the option, you need to reastart the SSH server (or reboot))
* On A, run "> ssh -X B", login and password. You should now be logged into B.
* Type the name of the program you want to run on B and see on A. For example: "> firefox". This may be a bit slow depending on your network, etc, but you should see the window for your program pop up.

I do this sort of thing on a daily basis, and I never have to mess with any DISPLAY variables or anything. I would think something was set up really strange if you needed to. You also shouldn't need to mess with the "xhost" command at all.

The reason the startx command isn't doing what you want is because the startx command starts an X server. An X server is what communicates with the graphics hardware to draw to the screen. So, if you run startx on B, no matter how you set up your DISPLAY variable, the startx command on B will always draw to B's screen.

There is another method to remotely display windows on other X servers, but it is a little more complicated, and not encrypted at all. Because you are using SSH, you can skip the whole mess and just use SSH's X11 forwarding feature.

Does that help?

alunduil 03-16-2006 11:18 PM

To activate X forwarding on the client:

Code:

echo "ForwardX11 yes" >> ~/.ssh/config
To activate it on the host:

Check the file /etc/ssh/sshd_config for a line reading similar to the above, and verify that it has the setting you want.

Then to log in and use remote applications:

Code:

ssh hostname
application

You will get the application popping up without having to redirect your X server or anything like that.

Regards,

Alunduil

frankie_DJ 03-17-2006 12:03 AM

Thanks for replies. This is what I did
On remote computer, B, I put in /etc/ssh/sshd_config file a line:
Code:

X11forwarding yes
On the local computer A I put in /etc/ssh/ssh_config a line
Code:

ForwardX11 yes
Then I login from A to B, and type
Code:

twm
I get
Code:

twm: can't open display ""
as before. What could be wrong now?

Harmaa Kettu 03-17-2006 12:35 AM

Quote:

3. On B, logged from A: export DISPLAY="A:0.0"
This is wrong, it causes X programs to not use the SSH tunnel. SSH sets DISPLAY to correct value automatically (typically something like localhost:10.0).

frankie_DJ 03-17-2006 04:23 AM

thanks guys i got it to work.

frankjoshua 06-14-2006 10:00 PM

Check out this article.
Running remote Xwindows Apps


All times are GMT -5. The time now is 09:09 AM.