Solved

SSH X Forwarding

Posted on 2002-04-24
11
361 Views
Last Modified: 2010-04-22
I do understand that SSH X Forwarding can be done in this manner.  (correct me if I'm wrong) ie.

SSH Client logins to SSH Server.
runs a X Window application in the connected SSH terminal, such as "xterm" or "xeyes" and SSH automatically(usually) forwards the X display to the SSH Client machine.

a.com$>ssh b.com
login successfully
b.com$>xeyes

And xeyes will be displayed on a.com.

If my understanding of SSH X Forwarding is correct, then is it possible for the server to establish a connection from SSH server to the client instead and open up xeyes?

Assuming that client also has a SSH server running.

ie. b.com ssh to a.com and runs the X Window application on a.com's X server.

regards
Yam
0
Comment
Question by:YamSeng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6967821
> ie. b.com ssh to a.com and runs the X Window application on a.com's X server.

Yes.
If a.com runs sshd with X-Forwarding enabled.
Then the only important part is the DISPLAY environment variable, or the -display option passed to the application.

A more or less usefull example:

   a.com$> ssh b@b.com ssh a@a.com xterm -display c.com:0
 
(assuming that X ports are available, and xauth allows it)
0
 
LVL 1

Author Comment

by:YamSeng
ID: 6968416
hmm......but -display would actually use the X Window System to display the graphics using the X Server at c.com right?

If it's so, then the channel between c.com and a.com would just be a purely data channel.  Not encrypted.

I was thinking of using the SSH X Forwarding instead of the X Window System.

I think my previous example of what I want to do may not be too clear.  Let me have another go.

server.com ssh to client.com, runs a X client on server, but display it on client.com.  All of these done using SSH X Forwarding, and not X Window System.

Yam
0
 
LVL 4

Expert Comment

by:MFCRich
ID: 6968521
<<If my understanding of SSH X Forwarding is correct, then is it possible for the server to establish
a connection from SSH server to the client instead and open up xeyes?>>

The server _never_ initiates the session.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 6968650
> runs a X client on server, but display it on client.com.
this is encrypted, 'cause ssh tunnels X
0
 
LVL 1

Author Comment

by:YamSeng
ID: 6973040
ahoffman,

so to use ssh to tunnel the X, I should use the command you mentioned earlier right?  ie

a.com$> ssh b@b.com ssh a@a.com xterm -display c.com:0

so for this command, how many ssh connections would there be?  will there be 1 from b.com to a.com and another one from a.com to b.com?

I can only initiate 1 ssh connection from server.com (with X client) out to a client.com (with X server).
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6973745
hmm, as I understand your questions in previous comment, you do not yet know what you want to do.
Could you please clarify for you, and then print it for me here:
     - at which host do you want have the application diplayed
     - at which host should the application run
     - at which host are you typing on the keyboard
     - which connection should/must be encrypted


Meanwhile, just answering question from previous comment:

> .. I should use the command you mentioned ..
depends

> .. how many ssh connections ..
2

> will there be ..
yes

> I can only initiate 1 ssh connection ..
my command does only initiate one connection per host
0
 
LVL 1

Author Comment

by:YamSeng
ID: 6976276
Hi ahoffman,

Initially I was using the X Window to forward the DISPLAY. So I ran my application (X Client) on my server, and display it on my client(X Server), with the keyboard and everything on the client as well.  So it was something like this:

server.com$>setenv DISPLAY client.com:0.0
server.com$>xeyes

And xeyes will be displayed on client.com and also receiving keyboard and mouse entries from there too.  However, between server.com and client.com there is a data channel from server.com to client.com.  1 way.  And it was not encrypted.

I was thinking of replacing this with SSH X Forwarding instead.  However, I cannot let client.com to establish a connection from client.com to server.com as my server.com has a firewall blocking incoming tcp traffic.  That is why my initial  X Window System method works as it's just going out of the server.com.

I hope the above information is clear enough now.  Sorry about the initial posts, I think I wasn't clear enough.

client.com - at which host do you want have the application diplayed
server.com - at which host should the application run
client.com - at which host are you typing on the keyboard
- which connection should/must be encrypted: I need only 1 encrypted connection from server.com going to client.com.  Just like the way I use X Window System to set the display to another machine.

regards
Yam
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6976512
client.com$> ssh user@server.com
# then you're on server.com, ssh should have set DISPLAY proper
server.com$> xeyes

this way you have encryption in both ways, 'cause ssh uses its private port to tunnel all the X-traffic (if X-Forwarding is enabled).
0
 
LVL 1

Author Comment

by:YamSeng
ID: 6976742
but if the firewall blocks all incoming traffic to server.com, the first statement:

client.com$>ssh user@server.com

will not be successful isn't it?
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 6976904
which firewall blocks? that in front of server.com, then you cannot connect it at all.
0
 
LVL 1

Expert Comment

by:seva
ID: 6982155
BTW, you should not set the DISPLAY variable explicitly
when using SSH X-forwarding. It will be set for you
by the SSH server
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Multipart email template with broken links (PHP/Postfix) 5 342
Identify Linux loader 67 189
Linux Search 3 68
bash file 10 88
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question