LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 05-26-2006, 01:44 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
SSH and X forwarding?


Ok, I think this is a great idea, but I can't get it to work.

I have a Linux box at home, and one at work, both running Fedora 5. I gave myself full access in and out of my networks on both boxes. So I don't think firewalls are an issue.

But ... I try the following:

Work CPU:
$ xhost +xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx being my home computer)
$ ssh -X xxx.xxx.xxx.xxx

Home CPU (via SSH session):
$ export HISTORY=yyy.yyy.yyy.yyy:0.0
$ gedit
cannot open display: (null)
Run 'gedit --help' to see a full list of available command line options.

or

$gedit --display=yyy.yyy.yyy.yyy:0.0
cannot open display: yyy.yyy.yyy.yyy:0.0
Run 'gedit --help' to see a full list of available command line options.

What's supposed to happen is the gedit window should display on my work computer. What am I missing?

UPDATE:
On my home CPU: I have verified that the 'X11Forwarding Yes' line in the /etc/ssh/sshd_config file is uncommented.
On my work CPU: I tried the ssh -Y option instead of -X.
Neither of these have worked.

Last edited by SlowCoder; 05-26-2006 at 02:20 PM.
 
Old 05-26-2006, 01:50 PM   #2
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Sorry, I had another question ...

Assuming I get this working, what would be the ramifications of starting 'exec gnome-session &' within my SSH session, rather than just an application? Would I then have my home GNOME desktop displayed on my work CPU, allowing me to work as if using something like VNC?
 
Old 05-26-2006, 01:54 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Investigate "FreeNX" and "NoMachine NX client". Both are free. Simple to setup, and MUCH MUCH faster than X forwarding. MUCH faster!!! There have been several threads on this topic in these forums.
 
Old 05-26-2006, 02:16 PM   #4
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by haertig
Investigate "FreeNX" and "NoMachine NX client". Both are free. Simple to setup, and MUCH MUCH faster than X forwarding. MUCH faster!!! There have been several threads on this topic in these forums.
I appreciate your suggestion. I'm still in the uphill learning phase of Linux, and in Linux style, I'd like to learn about what I'm doing wrong. Therefore I'd like to get this solution to work properly, then I will play with other options. Can you help me there?
 
Old 05-26-2006, 03:07 PM   #5
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Quote:
Originally Posted by SlowCoder
Ok, I think this is a great idea, but I can't get it to work.

I have a Linux box at home, and one at work, both running Fedora 5. I gave myself full access in and out of my networks on both boxes. So I don't think firewalls are an issue.

But ... I try the following:

Work CPU:
$ xhost +xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx being my home computer)
$ ssh -X xxx.xxx.xxx.xxx

Home CPU (via SSH session):
$ export HISTORY=yyy.yyy.yyy.yyy:0.0
$ gedit
cannot open display: (null)
Run 'gedit --help' to see a full list of available command line options.

or

$gedit --display=yyy.yyy.yyy.yyy:0.0
cannot open display: yyy.yyy.yyy.yyy:0.0
Run 'gedit --help' to see a full list of available command line options.

What's supposed to happen is the gedit window should display on my work computer. What am I missing?

UPDATE:
On my home CPU: I have verified that the 'X11Forwarding Yes' line in the /etc/ssh/sshd_config file is uncommented.
On my work CPU: I tried the ssh -Y option instead of -X.
Neither of these have worked.
* Do not do xhost or export anything or set display to anything; that defeats the purpose of X forwarding
* What is the output of "echo $DISPLAY" in your work computer before you SSH?
* What is the output of "echo $DISPLAY" on your home computer when you use SSH with X forwarding?
* Did you change the X11Forwarding directive recently? and if so, did you restart the SSH server afterwards?
 
Old 05-26-2006, 03:51 PM   #6
lotusjps46
Member
 
Registered: Apr 2003
Location: Dallas
Distribution: Vector Linux, Suse 10.1
Posts: 186

Rep: Reputation: 30
I understand that you would like to get this to work, but VNC is so much faster and easier to set up that it might be more funt to try first. I use TightVNC from work to home, tunneled through a ssh client called PuTTY (I am on it now at work). It is easy to set up from MS Windows or Linux.

Start the vnc server on the host machine with "vncserver". Open vncviewer on the client machine (google for the command or read the TightVNC website; I forget the stuff that goes after "vncviewer"). Give the viewer the IP or domain name of the server. It will ask for a password and it will come up with a window from the server on the client. You have to edit the vnc configuration file to open different window managers. If you cannot get it running come back and we can do some more detailed instructions.

Good luck.

C
 
Old 05-26-2006, 08:35 PM   #7
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by spooon
* Do not do xhost or export anything or set display to anything; that defeats the purpose of X forwarding
* What is the output of "echo $DISPLAY" in your work computer before you SSH?
* What is the output of "echo $DISPLAY" on your home computer when you use SSH with X forwarding?
* Did you change the X11Forwarding directive recently? and if so, did you restart the SSH server afterwards?
All of the instructions I've received say to reset the DISPLAY, and to set xhost permissions to allow X forwarding from the server.
'echo $DISPLAY' on the work CPU returns ':0.0'
'echo $DISPLAY' on the home CPU returns 'localhost:10.0'
I did not reset the X11Forwarding. It was already set. I have, however, restarted the home CPU a couple of times recently.

Until recently I have been using VNC, but that stopped working. I do know it's not a problem on the clients themselves, as they work with other computers on the same networks. My work firewall and home firewalls are set to allow all traffic between the 2 hosts. But there is a firewall between us (at a university campus), and I'm thinking they may have blocked VNC because it's insecure. This is why I'm looking for other methods.

I am willing to try different solutions. I just want to know the what's, how's and why's of my options. I also tend to lean on the minimalist side. The less software that needs to be involved, the better.

Last edited by SlowCoder; 05-26-2006 at 08:40 PM.
 
Old 05-26-2006, 09:18 PM   #8
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Hrmmm ...

I got it working, which is good (info below). Spooon, you were right about xhost and DISPLAY. I didn't need to change those. It appears that SSH takes care of that for me, as you said. Thanks for that tip.

What I did:
Logged in via ssh: 'ssh -X me@xxx.xxx.xxx.xxx'
Verified that correct display was set on the server: 'echo $DISPLAY' in the SSH window gave me 'localhost:10.0'
Executed my X apps: 'gedit', 'xterm' or 'firefox'.

I did find that using this form of tunnelling for this purpose is slow. But in the absence of alternatives, should do in a pinch.

One more hurdle learned and conquored! Thank you for your help guys!
 
Old 05-28-2006, 10:24 PM   #9
pokemaster
Member
 
Registered: Apr 2005
Location: Massachusetts, USA
Distribution: debian,ubuntu,slackware
Posts: 110

Rep: Reputation: 17
you can get VNC working -- I've done it through a severely restrictive network. VNC was no-go. Port 80 was open, but VNC traffic was dropped. Port 22 was closed (SSH default), so I ran SSH on 80 -- no go, encrypted traffic is also dropped. So, I ran SSH on port 443 (https), which worked!

Then I forwarded ports:
Code:
ssh -p 443 my.home.address -L5901:localhost:5901
where the 5901:localhost:5901 tells it "When I access port 5901 on this local machine, forward those packets to port 5901 on the remote machine." This assumes your VNC server to be running on display:1. Simply add your display number to 5900 to get your port number, and sub it in. Then tell vnc to access localhost:1 (or whichever display you're using.) Type 'man vncviewer' and look at how to adjust the encodings, because on my current machine, if you try to access localhost, it assumes you want a raw encoding... very slow over a network.
 
  


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 X forwarding krusty_lab AIX 10 01-02-2008 09:36 AM
Need HELP SSH X11 Forwarding wylie1001 Linux - Software 2 04-11-2006 08:12 PM
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 - Newbie

All times are GMT -5. The time now is 04:33 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