 |
 |
X11 forwarding from Mac to Unix
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Status:
Offline
|
|
Hi,
I'd like to access X11 applications on my Mac at home from the Solaris boxes at my university. How do I setup that?
There are dozens of explanations for the other way round, getting X11 applications from the university onto the mac, but I couldn't find one for my case.
Thank you,
Daniel
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by danengel:
Hi,
I'd like to access X11 applications on my Mac at home from the Solaris boxes at my university. How do I setup that?
There are dozens of explanations for the other way round, getting X11 applications from the university onto the mac, but I couldn't find one for my case.
It works the exact same in either direction. There are two hosts. One has the X11 application. The other has the X11 Window server running. In your case the application is on the solaris box.
To do this, open up X11.app on your Mac (can download it here if you do not have it). Then, telnet or SSH into the Solaris box. When you get there, if your shell is sh, ksh, bash, or zsh, do this:
Code:
DISPLAY="my.ip.address"
export DISPLAY
If you are using csh or tcsh, do this:
Code:
setenv DISPLAY "my.ip.address"
replacing "my.ip.address" with your real IP address of your Mac.
Then, just run the X11 application from the telnet window:
That's all there is to it. The app should pop up on your Mac's display inside X11.app.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Status:
Offline
|
|
I wanted it the other way round: the X11 application should run on the Mac at home, and I would ssh from the university to my Mac. The window should appear on the university computer
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status:
Offline
|
|
Originally posted by danengel:
I wanted it the other way round: the X11 application should run on the Mac at home, and I would ssh from the university to my Mac. The window should appear on the university computer
On home machine... edit /etc/sshd_config
X11Forwarding yes
then restart the sshd (assuming ssh access already working in text mode)
You need to have X11 running on your home machine (99% sure). (so start it via cmd-line ssh, or launch it before you leave home)
at the school machine:
xhost + (allows your machine to open windows there)
then
ssh -X -l username your.machine (-X sets X11 forwarding so you don't have to do a setenv DISPLAY).
Curiously my term says vt100 at this point, but if you then
xterm &
you'll pop open a window on the school machine.
Note that in X11 terms, the school machine is the X11 "server" and your home machine is the "client" (wacky but thats how they define it).
Mike
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status:
Offline
|
|
Originally posted by Zim:
xhost + (allows your machine to open windows there)
then
ssh -X -l username your.machine (-X sets X11 forwarding so you don't have to do a setenv DISPLAY).
Mike
Argggh! Don't do "xhost +"; it allows *any* machine to open windows on your school display (as well as other much less amusing things, like reading your keyboard input). In fact you shouldn't need to know about xhost at all in order to do what you're seeking. Just ssh in to your home machine from school as illustrated above by Mike, and start behaving in an X-ish sort of manner! (That is, issuing commands like "xterm &", "xfig&", "xclock&"...) Using ssh for X traffic is great *because* it negates the need for xhost/DISPLAY nonsense.
It should all work without the xhost stuff because the "pseudo-X-server" set up by ssh is *local* to the machine on which the application is running. In this case your home machine. After logging in via ssh -X if you do a "printenv DISPLAY" you'll see something like "localhost:5.0". Stuff sent to this server is then piped back to your school machine along the encrypted channel and displayed using the X-server located there. Neat trick.
Cheers,
Paul
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status:
Offline
|
|
Paul is right that xhost + (with no machine name) is a security hole... but I was just getting this working the other day, and I am 95% certain I needed to use xhost (else I got the "could not open display" mesg...). If Daniel gets the err msg, then the compromise would be to do
xhost +your.home.machine
so then at least you are only vulnerable from that machine and not the whole world.
And besides, if you can't pop up xeyes, or something like that, on an unsuspecting neighbor, what fun is life??
Mike
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status:
Offline
|
|
Hmm: I use this method every day (and certainly never have to touch xhost). Give it another go!
Just make sure your display is set on (say) your mac to :0.0 before ssh-ing to the foreign machine with.
ssh -X foreign.machine.name
and away you go. Only thing I can think of that might be getting in your way is if your display is being automatically set on the foreign machine (and thus overriding the localhost:14.0 or whatever that ssh would be setting it to).
As for popping up xeyes et al: beware of your target! We've had some *very* grumpy staff to deal with after being taken in by some of the fun little X-apps that you can run on another person's display. Things like reversing all the windows, slowly "melting" all the windows and so on. Much, much fun when applied to friends' machines, but oh boy, watch out when the wrong person's chosen (especially if they make the mistake of reporting hardware problems etc to systems staff before realising what was up!). Breathing fire so they were...
Cheers,
Paul
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Status:
Offline
|
|
I uncommented the following line in /etc/sshd_config: "X11Forwarding yes"
If I ssh to my mac: "ssh -X xx.xx.xx.xx"
then try to start xeyes: "xeyes &"
It says: "Error: Can't open display: localhost:0.0"
Indeed, "echo $DISPLAY" says "localhost:0.0"
Strange...
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status:
Offline
|
|
Originally posted by danengel:
I uncommented the following line in /etc/sshd_config: "X11Forwarding yes"
If I ssh to my mac: "ssh -X xx.xx.xx.xx"
then try to start xeyes: "xeyes &"
It says: "Error: Can't open display: localhost:0.0"
Indeed, "echo $DISPLAY" says "localhost:0.0"
Strange...
Did you restart the sshd (either by a reboot, or a kill -HUP sshd_process_id) ?
If so, then try the part about xhost +your.computer, typed in to your Xwindow running on the school computer (this tells the school computer to allow X connections from outside itself)
Mike
(Last edited by Zim; Apr 23, 2003 at 07:15 AM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Status:
Offline
|
|
Oh, me stupid! I had this silly line in my ~/.cshrc: "setenv DISPLAY localhost:0.0" which screwed up everything.
Sorry for the trouble.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Sep 2000
Location: Adelaide, Australia
Status:
Offline
|
|
Originally posted by Zim:
You need to have X11 running on your home machine (99% sure). (so start it via cmd-line ssh, or launch it before you leave home)
You don't need to run X11 on the machine that is running the X-apps. I just checked that X11 is not running on my work machine but I can run shh -X into my work machine from x11 running on my machine at home and make an xclock pop up.
UNIX people will tell you the naming is correct for client/server. The x11 you are sitting in front of is serving windows to the app which is on the remote machine. Its like you walk into the restaurant and serve up a plate for the client waiter to put some food on :-).
Michael
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|