Solved

SSH X Forwarding

Posted on 2002-04-24
11
355 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
11 Comments
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> 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
Comment Utility
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
Comment Utility
<<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
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> 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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
which firewall blocks? that in front of server.com, then you cannot connect it at all.
0
 
LVL 1

Expert Comment

by:seva
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now