LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-16-2006, 10:05 PM   #1
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Rep: Reputation: 31
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?

Last edited by frankie_DJ; 03-16-2006 at 10:41 PM.
 
Old 03-16-2006, 11:17 PM   #2
visaris
Member
 
Registered: Dec 2004
Distribution: gentoo
Posts: 190

Rep: Reputation: 30
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?
 
Old 03-16-2006, 11:18 PM   #3
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
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
 
Old 03-17-2006, 12:03 AM   #4
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 31
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?

Last edited by frankie_DJ; 03-17-2006 at 12:04 AM.
 
Old 03-17-2006, 12:35 AM   #5
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
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).
 
Old 03-17-2006, 04:23 AM   #6
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 31
thanks guys i got it to work.
 
Old 06-14-2006, 10:00 PM   #7
frankjoshua
Member
 
Registered: May 2006
Posts: 32

Rep: Reputation: 15
Check out this article.
Running remote Xwindows Apps
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote Server, Local Printing, on Windows coolamit78 General 0 06-11-2005 04:01 AM
rc.local not starting my application Greenman Linux - Newbie 11 08-17-2004 03:35 PM
Updating a remote server with a local cd korozion Linux - General 4 07-15-2004 04:19 PM
Backing up remote Linux Server to Local Win2KPro CD-RW over SSH McK66 Linux - General 3 06-08-2004 09:05 PM
Remote Mounting? (Mount remote folder on local filesystem) mac_phil Linux - Networking 1 11-15-2003 03:48 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration