LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-20-2006, 03:26 AM   #1
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
ssh over ssh - X forwarding


So, here I am. There is a program that I need to use, on a machine I cannot ssh to directly..I can ssh to another machine, from where I can access that other machine, and run the program (in text mode) over ssh over ssh.

But, I'd need to get it X-forwarded (the GUI would be in this case far better than text). The first machine where I ssh to does X-forwarding ok, and I get all kinds of X-stuff over the ssh. And the other machine does X-forwarding, or at least it ought to do, but it seems it only forwards to the first machine, and not to my machine..

Is it possible to get the X-forwarding work from the 2nd machine via the 1st machine to my own machine? Or does it simply "die" on the 1st machine that's between me and the program. Damn. That sounded complex..

Also, could it have something to do with this that I only seem to get the X-forwarding work if I start ssh with root privileges (which is really not what I'd like to do)?

Here's what's happening in a text-based gui

MyMachine <---ssh---> Machine1 <---ssh---> TheApp

And here's what ought to happen:

MyMachine <--ssh/X11--> Machine1 <--ssh/X11--> TheApp

So, ssh-gurus, ideas?

P.s. I can't ssh to the other machine directly because the connections are restricted to the "inner" network only, and only one machine is able to take (only certain) connections from the outside world..
 
Old 02-20-2006, 03:32 AM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
It should work. What commands are you using? Are you sure that machine 2 accepts X forwarding?
 
Old 02-20-2006, 04:15 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I could be that your machine is rejecting the X server traffic from the second machine. Try using the '-Y' option and see if that works.
 
Old 02-20-2006, 09:03 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Original Poster
Rep: Reputation: Disabled
no, it doesn't work..even with the -Y option. I only get

xset: unable to open display ""
xset: unable to open display ""
xset: unable to open display ""
Can't open display

and that's it..and the X11 forwarding is enabled in both of the machines as far as I know. From the first machine (the one that's between me and the program) I can run things like xclock and they do appear in my own desktop, but anything started from the 2nd machine where the program I need is, only gives me those xset: -lines...

I've set in my ssh settings X11 forwarding (both trusted and the other one) enabled, and it works (I can run xclock from the 1st machine), but only if I sudo ssh. When I have a connection to the other machine, I simply run the command I need ("xclock" command works) without any special options..
 
Old 02-20-2006, 01:22 PM   #5
CatGrampy
LQ Newbie
 
Registered: Aug 2005
Location: SoCal Desert
Distribution: SUSE 10.1
Posts: 18

Rep: Reputation: 0
Did you try ssh -X ?
 
Old 02-20-2006, 01:41 PM   #6
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Original Poster
Rep: Reputation: Disabled
I tried ssh -X a moment ago, no luck :/ I really wonder what is going on, since I checked again, and X11Forwarding is enabled on both of the machines, but something happens between the 1st and the 2nd machine since the forwarding works from the 1st machine, but not from the 2nd..

I only wonder what could happen between the machines..
 
Old 02-20-2006, 02:18 PM   #7
pAn1k
Member
 
Registered: Jun 2004
Location: Cala city
Distribution: Suse 10.0; Debian 5.0 (Lenny) Fluxbox
Posts: 240

Rep: Reputation: 30
Are you trying to do this as a regular user, or as root?
 
Old 02-20-2006, 07:18 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
When you ssh to the second machine, check the value of the DISPLAY variable. It should be something like ":10.0" or "11:0" but I'm guessing that it isn't defined.
 
Old 02-20-2006, 07:22 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Check both the /etc/ssh/ssh_config and /etc/sshd_config files.

From /etc/ssh/sshd_config:
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
 
Old 02-27-2006, 09:16 AM   #10
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Original Poster
Rep: Reputation: Disabled
problem solved.

for some reason doing ssh -X in both of the machines (my own and the one between me and the 2nd machine) caused the program to run. Nice. Still I thought the ssh_config files were ok on every machine, so that the -X wouldn't be needed..anyway, not supposing anything and just using that -X did the trick I haven't found out yet why I have to use that -X on the 2nd machine too, since the configs say X11 forwarding is enabled..

well, now I learnt not to trust simple config files before trying command line options first. Thanks for everybody for you assistance..
 
Old 02-27-2006, 10:12 AM   #11
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Enabling X11 doesn't necessarily mean that you want to use it.
There is a difference between the server config that enables (aka "allows" the forwarding of X11 connections and the client that actually "asks" to get an X11 connection over the SSH connection (this is the -X option).

If the client can ask for X11 connections by default in his config, then you should have the same X11 settings for SSH on both your machine and "machine1" to make it work, I suppose.
 
  


Reply



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
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
SSH X forwarding krusty_lab AIX 10 01-02-2008 09:36 AM
SSH X forwarding djgerbavore Linux - Networking 1 11-17-2005 09:40 AM
X forwarding via SSH bd1308 Linux - Software 4 08-30-2005 07:13 PM
ssh and X-forwarding Björneborg Linux - Networking 2 02-19-2004 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05: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
Open Source Consulting | Domain Registration