# no x windows on remote servers



## zberke (May 6, 2002)

I can get new windows from my local server (if i type xterm or xemacs locally, it pops up new windows).  however, when i am logged into a remote server, i invariably get a message which says:

[zberke@tacos zberke]$ xterm
xterm Xt error: Can't open display: 

I'm not sure if this is related, but when I boot x using "startx -- -quartz" I get the following errors:

Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".

another interesting, hopefully useful error i get, when i try to get new x windows from within matlab (on a remote server), i get the following error:

[zberke@tacos zberke]$ matlab
>> spm fmri

Initialising SPM..??? Error using ==> spm
Can't open any graphics windows...

Error in ==> /afs/dbic.dartmouth.edu/usr/local/common/spm/spm99/spm.m
On line 489  ==> WS   = spm('WinScale');                                %-Window scaling factors

Error in ==> /afs/dbic.dartmouth.edu/usr/local/common/spm/spm99/spm.m
On line 439  ==> Fmenu = spm('CreateMenuWin','off');                            fprintf('.')

>>


----------



## howardm4 (May 6, 2002)

when your sitting on the 'remote' machine,
it seems like you haven't set the DISPLAY
environment variable which tells the
application where/which machine the window
should open on.


----------



## zberke (May 6, 2002)

Thanks, but how do I tell the remote machine to open the display on my machine?


----------



## howardm4 (May 7, 2002)

usually done w/ setting the
environment varialbe display.

In {t}csh:
setenv DISPLAY   name_of_box_to_display_on:0

Or, usually, you can do it on the command line
when you invoke the application such as:

gimp -display remote_machine:0


----------



## zberke (May 7, 2002)

>> setenv DISPLAY name_of_box_to_display_on:0 
>> gimp -display remote_machine:0

i don't have a servername as far as i know.  i'm on a wireless network at a University and since i'm running os x on a laptop so my IP is always changing.  how do i identify myself to the server?

what i'm asking is:
name_of_box_to_display_on = ?
remote_machine = ?

not to overly philosophize, but i guess my real question is: who am i?  
(i've been up all night, forgive me).

thanks!


----------



## zberke (May 7, 2002)

OK, at a friends' advice i did this:
- i decided that i am my IP address (is this correct?)
- on my computer i typed xhost +friend.dartmouth.edu
- i ssh'ed to friend.dartmouth.edu
- i type 'export DISPLAY=<myip>:0'
- it takes a few moments, then reports:
xhost:  unable to open display "<myip>:0"



any help would be greatly appreciated.  thanks!


----------



## BSDimwit (May 7, 2002)

do an  xhost +<yourmac'sip> on the friend.dartmouth.edu computer?  Doesn't this command allow x server access to the specified host?

Your computer is acting as the host and the dartmouth.edu machine is acting as the x server... Correct?


----------



## scruffy (May 7, 2002)

If you log in from a locally running xterm (not a terminal.app window) that should set the DISPLAY environment variable alright.  Another option would be to use the X11 forwarding option of ssh - you get your X connections encrypted for free.  Also must be from an xterm, not terminal.app:

ssh -X me@some.comput.er

or
ssh -XC me@some.comput.er
to turn on gzip compression of the ssh stream to make X11 slightly less agonizing on slowish connections.


----------



## jmil (May 8, 2002)

Someone once emailed this to me when I was having similar problems. I think it will fix your problem as well:

"There is one subtle point to consider when ssh-ing to a remote machine
and displaying whatever program you are running on your machine.  OS X
ssh is set up by default to not do X11 forwarding.  You need to open up
the file /etc/ssh_config (as root or using sudo), uncomment the line
near the beginning of the file that says "ForwardX11 no", and then
change that line to "ForwardX11 yes".  After that you will be off to the races."


jmil


----------



## kilowatt (May 8, 2002)

scruffy has it right, but I'd like to take this chance to talk about two different ways of doing this.

1) Tunneling. Its possable to use ssh -X to 'tunnel' your X11 connection through your ssh connection. This provides encrypted X11.

2) Remote. Using xhost on your computer (such as: xhost  +remoteserver) one can allow the X11 application to open connections on your computer. This in insecure, and doesn't work through un-configured firewalls.

With ssh -X, you generally don't have to set $DISPLAY or use -display on your apps, and its generally easier this way.

PS: OF course, you have to allready have XFree86 running to do this on the client computer.


----------



## baudot (May 31, 2005)

Great thread on explaining an otherwise deceptive bug.  I'm running into this same issue when trying to run a homebrew program on my friendly neighborhood robot.  I get the error on my mac, I don't get it from the public Linux terminal sitting next to it.

I've tried the ssh -X option.
I've tried the reconfiguration of /etc/ssh_thingy
I haven't been successful in getting the DISPLAY environment variable to point somewhere that produces no error messages, although it does produce DIFFERENT error messages when I start messing with it. (Namely: Error: Can't open display: <my ip>.  This would be a problematic solution regardless, as I'm on DHCP & sans name.)


----------



## lurk (May 31, 2005)

Are you using Tiger?  If so it is running a newer version of OpenSSH and you need to use -Y instead of -X.


----------



## baudot (May 31, 2005)

THANK YOU.
The -Y did it.
Now why aren't the manpages up to date on this?  grrrrr....


----------

