displaying xterm apps from remote linux system ?

Hi all,

I can't seem to get this basic functionality to work.

I'm running Apple's x11 on my powerbook. I also have a SuSE linux system on my LAN. I'm logged into the terminal app on my powerbook, I ssh over to the linux box, do "export DISPLAY='powerbookIPaddress'😮", then xclock.

I expect to see the xclock app open on my powerbook (I do this sort of thing all the time between other Unix systems), but instead I keep getting "cannot open x server".

I cannot find the 'xhost' command on the powerbook to add authority for the linux box. So how does one do this???

bigtiny

Posted on Oct 21, 2005 8:13 PM

Reply
12 replies

Oct 24, 2005 2:23 PM in response to Keith Hedger

I struggled with a similar issue from a different perspective. I set the DISPLAY variable in my .bash_profile so that I didn't have to do it every time I started terminal.app. Of course, this overrode the automagic configuration of DISPLAY on a remote system when I tried to tunnel X11 through ssh. Jeff Hubbach's solution, to have the script set DISPLAY only if null, is one way around this.

By accident today I discovered another way. I was downloading openoffice.org 2.0 and they pointed to this ADC page: http://developer.apple.com/darwin/runningx11.html. There are benefits of using terminal.app to start X clients that come from the full integration of terminal.app into OSX. So I stripped out the setting of DISPLAY from my .bash_profile, and I just used the "open-x11" script referred to on the ADC page to start X clients automagically from terminal.app.

Ironically, this works locally but STILL doesn't set the DISPLAY variable on the local system. Thus, if you use "ssh -Y" in terminal.app to connect to a remote machine, the DISPLAY variable on the remote machine isn't set properly, either. It seems that Jeff Hubbach's solution is the most straightforward by being universal.

Oct 22, 2005 11:47 AM in response to Karl Zimmerman

Okay,

I tried 'ssh -X userid@IPaddress of the linux box
export DISPLAY='IPaddressofpowermac'😮
xclock

and got:

~> xclock
Xlib: connection to "192.168.1.202:0.0" refused by server
Xlib: No protocol specified

Error: Can't open display: 192.168.1.202:0
~>

On the powermac executed the xhost command to add the linux box (just in case this was the problem) and got:

xhost: unable to open display ""

So basically the same symptoms as last night. The x11 program IS running on the powerbook (is there anything I need to do special to run the xserver or does it run when the app is started?)

bigtiny

Oct 22, 2005 12:25 PM in response to Keith Hedger

I tried 'ssh -X userid@IPaddress of the linux box
export DISPLAY='IPaddressofpowermac'😮
xclock

No, you shouldn't have done the export DISPLAY= line.

SSH X11 forwarding is a wonderful thing. It encrypts all X11 traffic, which is nice. But even nicer, it sets up all the necessary DISPLAY variables for you so you don't have to worry about it. On the server you're SSHing to, the DISPLAY should look something like this: localhost:10.0

Do the following, step by step:

1) open X11 on the mac
2) open an xterm (or terminal, doesn't matter as long as DISPLAY gets set up, but it's easier from the xterm).
3) echo $DISPLAY (you should get 😮.0)
4) open xeyes locally, make sure that works
5) ssh -Y username@serverip
6) echo $DISPLAY (you should get localhost:10.0)
7) open xeyes on the server, it should pop up on your mac.

You don't have to worry about DISPLAY (other than ensuring it's set locally before you ssh to the server), you don't have to worry about xhost, and you don't have to worry about the firewall (because everything is tunnelled (sp?) through SSH on port 22).

Simple. Much much simpler, and more secure, than manually configuring all that stuff.

Oct 22, 2005 12:40 PM in response to Jeff Hubbach

Interesting......

I followed Jeff's instructions (which are basically the other respondants instructions) and it worked.....only this time I issued the ssh and x commands from within an xterm.

So I logged out of everything and went back and tried from terminal....no go!!!

So, I guess I should issue these commands from an xterm in the future...that's interesting.

Thanks for all of the help gentlemen.

bigtiny

Oct 22, 2005 1:27 PM in response to Keith Hedger

Keith,

As Karl already said, that's because Terminal doesn't set the DISPLAY environment variable (which is why I had you echo it, and try to open a local xeyes, first).

I have the following in my .bashrc (which is sourced in my .bash_profile), which sets up the DISPLAY env variable if it isn't already set. This allows me to, assuming X11 is open, open X11 apps from Terminal and ssh -Y from Terminal.

.bashrc (sourced in .bash_profile)

if [ "${DISPLAY}" == "" ]; then
export DISPLAY=:0.0
fi

Oct 25, 2005 9:25 PM in response to Keith Hedger

Hey guys
I am having a similar problem but the above solutiong does not work for me. I am trying to open an xterm app but get this message:

[ ~]$ nedit: the current locale is utf8 (en_US.UTF-8)
nedit: changed locale to non-utf8 (en_US)
NEdit: Can't open display

I am trying to open nedit from a remote unix server but it won't seem to work. Any help would be appreciated.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

displaying xterm apps from remote linux system ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.