# [SOLVED]  Problems with ssh X forwarding with Mac OSX

## MighMoS

I'm not sure entirely where the problem is, as I've never done this before.  Let me breifly describe my setup.  At home, I have a gateway (running X forwarding), and my workstation (also with X forwarding enabled in ssh).  I am trying to connect and run apps from my workstation from a Mac OSX machine, accross the internet.  I have connected with the -X switch in both cases.   

However, when I ssh to my gateway, then to my workstation, and try to launch any graphical program, I get an error about "could not open display" or "display unset".  This mac does have X11 protocols installed, but the gateway does not (even though it has X11 forwarding).  Does my gateway need X11 installed to forward the traffic, even if its originating from my workstation?  Or is it a problem w/ the Mac?

Please help me as iChat is driving me crazy!  I can't take it!!  :Wink:   :Wink:  Thankyou for your help.

----------

## boroshan

try editing /etc/ssh/sshd_config and setting AllowTcpForwarding and X11Forwarding to "yes". Make sure they're both uncommented and run /etc/init.d/sshd restart

fixed it for me, anyway

----------

## MighMoS

Ok, so far, its not working.  I've set up my gateway to forward port 22 straight through to my workstation, so i know its not the problem.  

Here's what I type to connect: 

```
ssh [my.i.p.address] -X
```

  Then it asks me for my password, so i know that went ok.  I enter my password, and then I'm then logged in as who I want to be, and can execute console commands just fine.  But when trying to launch a program I get this:

```
LocalHost% gaim

(gaim:4690): Gdk-CRITICAL **: file gdkdisplay-x11.c: line 360 (gdk_display_get_name): assertion `GDK_IS_DISPLAY (display)' failed

** (gaim:4690): WARNING **: cannot open display: unset

LocalHost%
```

 an echo $DISPLAY shows nothing, could that be the problem?  My workstation /etc/ssh/sshd_config:

```
bash-2.05b# grep -v "^#" /etc/ssh/sshd_config | grep '.'

Port 22

Protocol 2

ListenAddress 192.168.0.3

PermitRootLogin no

UsePAM yes

AllowTcpForwarding yes

X11Forwarding yes

X11DisplayOffset 10

TCPKeepAlive yes

UseLogin no

Compression yes

PidFile /var/run/sshd.pid

Subsystem       sftp    /usr/lib/misc/sftp-server
```

 Would I need to show the mac's (local) system's /etc/ssh/ssh_config file as well?

----------

## DrKayBee

isn't it supposed to be 

```

ssh -X user@xxx.xxx.xxx.xxx 

```

rather than

```

ssh xxx.xxx.xxx.xxx -X 

```

(note the position of the X forwarding flag. I may be wrong though...

KB

----------

## MighMoS

Moving the -X flag didn't affect anything.  I'm sure I'm going to kick myself once I find out the answer.  Question, when you forward x11 sessions, is the $DISPLAY variable set?  Because mine isn't.

----------

## MighMoS

HAH!  I knew there had to be an easy answer.  Under MacOSX its not enough for the X11 libraries to be installed.  I found an X11.app file, and running it popped up the X logo and xterm.  Running ssh from there <i>did</i> enable X11 forwarding.  And now, I can finally use all my wonderful linux programs (as despite what apple says, I can't get anything worth running working under OSX).  Yayness.  

Thankyou for your help though, it was very much appriciated.  (I'm sure my school will love this too   :Twisted Evil:  )

----------

## DrKayBee

Chee that was a simple one!

I remember having spent a long time doing all kinds of xhost+ and what not in the terminal before firing up X11.app - glad it worked out easy.

KB

----------

## eivinn

Have you found out how to run a remote window manager through the X11.app? I would like to run fluxbox in a window, but haven't had any luck yet. I can run normal applications yes, but I would like to have them all bundled into one window.

----------

## bzhao

 *eivinn wrote:*   

> Have you found out how to run a remote window manager through the X11.app? I would like to run fluxbox in a window, but haven't had any luck yet. I can run normal applications yes, but I would like to have them all bundled into one window.

 

use rdesktop command as a client and xrdp server  for remote machine

----------

