Link to home
Start Free TrialLog in
Avatar of greg_100
greg_100

asked on

Tunnelling Xsession through ssh

I want to run xwindow app to another machine through ssh. how would i go about setting that up? I am fairly new to linux.
Avatar of xscousr
xscousr
Flag of Canada image

export your display:

assuming:

local ip = 192.168.2.1
remote ip = 172.19.1.1

connect to your remote box:
ssh user@172.19.1.1
then enter:
export DISPLAY=192.168.2.1

on your local machine type:
xhost +172.19.1.1

if you want to run galeon on your remote system
type:
galeon &
the window will open on your local machine
Avatar of rfr1tz
rfr1tz

The above solution may work, but you may want to try the -X option.

ssh -2 -X 10.10.10.10

(After entering passwords, your window prompt now changes to indicate you've logged onto 10.10.10.10)

Enter, for example, "netscape"


The netscape browser will now appear on your screen, but it is actually running on 10.10.10.10. You don't have to set the display. The -X automatically sets it. (See the man for ssh)
cool - thanks for the tip rfr1tz

btw - galeon!!! :-)
So Galeon is pretty good, eh?

I've been using Mozilla, but webwasher (apparently) doesn't work with Mozilla. I guess I'll give Galeon a try.
Avatar of yuzh
To enable the REAL X tunneling, you need to do the followings:

1) Edit you ssh_config and sshd_config files, to make sure X forward is enable, put the following in the files:
ssh_config:
  ForwardAgent yes
  ForwardX11 yes

sshd_config:
   sshd_config
   X11Forwarding yes
   Make sure that you have them in both system (client and server)
   
   restart your secure server deamon (sshd)
2) If you have X forward enable, when you login to a remote machine, the DISPLAY should automatically set, eg the remote IP is: 172.19.1.1
    DISPLAY will be something like 172.19.1.1:x:0
    x - is depants on the number of connetions in the remote machine.
3) If you have X server running in your local machine, you should able to run X applcation in a remote machine, and display in your local station. (real tunnel)

    Have look at the following FAQ to learn more.
    http://www.tigerlair.com/ssh/new-faq/ssh-faq.html
If your trying to bring the XSession back to a windows machine.  First get a windows manager like Exceed.  Then Use SecureCRT and when you setup your connection under the SSH Properties under the X11 tab, click forward X11 Packets.  This automagically sets up your connection.  

If it is another linux machine disregard this and follow one of the suggestions above.

-=[ Felix ]=-
Avatar of greg_100

ASKER

I tried all the above ways but I get an error. I am using ssh client on a windows 2000 machine and have open ssh daemon on my linux machine.
You need to enable X tunneling (or X11 tunneling) in your Windows ssh client. (click on the profile or memu bar <Edit> option to enable X tunneling)

If you still couldn't work it out, please post the error message, and tell us which version of ssh client of ssh client for windows are you using.
I'm using  SSH Secure Shell Client 3.2.2. I checked the allow tunnelling box in the settings but I get the error GTK: ** unable to display "". I set the ssh_config and sshd_config for X11Tunnelling. What else Do I have to do?
you need to restart your secure server deamon (sshd)

BTY, do you start the Xserver in you win2k pc before runing the X app in the secure shell terminal?
The error I get now is Gdk-ERROR **: X connection to localhost:10.0 broken (explicit kill of server shutdown).

Do I need to have any other programs running on my windows machine besides SSH client?
Yes, you need to have Xserver in you win2k  (eg Xwin32 etc), have a look at the following page for information about the Xserver for windows:
https://www.experts-exchange.com/questions/20667765/Unix-equivalent-to-Microsofts-terminal-server.html
Do you know any free x servers that are good and is able to work with SSH client 3.2.2?
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yuzh,

it seem that you have to have the machine you are installing it on connected to the internet. my machines are standalone right now. So since you helped me out this much I don't want you to wait until I get them connected to the internet in a month to get your points. I'll try that x server next month. thanks.
You are welcome, cheers!