?
Solved

SSH X Forwarding

Posted on 2002-04-24
11
Medium Priority
?
366 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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 200 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

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

752 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