Starting an X11 client on another machine, without ssh
Bill Freeman
f at ke1g.mv.com
Tue Mar 23 15:06:19 EDT 2010
> On 03/23/2010 12:03 PM, Bill McGonigle wrote:
> > On 03/22/2010 04:13 PM, Bill Freeman wrote:
> >
> >> It seems like ssh is overkill for talking
> >> to a VM on your own box.
> >>
> > You're running two operating systems on one piece of hardware.
> >
> > -Bill
> >
> >
> In a way I agree with Freeman. But, a VM can be configured using
> different methods to virtualize the ethernet adaptor. If you are
> bridged, then that adaptor is open to the outside world (or al least
> your LAN). On most VMMs you can set up a common directory for file
> sharing. But, since you are on the same box, you should be able to
> access the guest OS desktop.
>
> --
> Jerry Feldman <gaf at blu.org>
The VM in NATed to the network by the host (maybe even by vmware player
somehow, but the hostside interface shows up in ifconfig). Only ports
on the VM that the NAT knows about could be accessed from off box.
The host, however, has unNATed access to the VM, so looking ssh-ing in
works, and looking at the twisted running on the VM with the host
browser (the VM doesn't run an X server) works fine.
The point is not to open the VM to the outside world, but to let X
clients running on the VM (particularly emacs) to access the X server
on the host. Then I can run emacs on the VM using my screen, keyboard,
and mouse.
This all works fine, set up by hand:
* Figure out that ubunto 9.10 runs X with -nolisten tcp and fix.
* Permit access from the client. I'm using:
xhost +name_of_vm_in_etc_hosts_or_just_its_ip_address
* On the vm, set the DISPLAY environment variable using the host's IP
and DISPLAY variable setting (':0.0').
* Run emacs in the background, pops up in host X.
But the old xon script was so darned convenient, taking care of everything
except the first item (which is a one time fix).
So now I have a pair of bash scripts, one on the host that just does:
xhost +vm_client
ssh username at vm_client '$HOME/remote_scripts/emacs '"$DISPLAY"
And one on the client in the not on the path "remote_scripts" directory,
which:
* Sources ~/.bash_profile to pick up path adjustments and environment
variables.
* Parses the host ip out of the SSH_CLIENT environment variable and
combines it with $1 (host's $DISPLAY) to set and export DISPLAY,
* Runs emacs in the background(*).
* Exits.
Which works, making me happy at the moment, but something more general,
akin to xon, would be superior.
Bill
[* This was the hardest to get right. If you just do:
emacs &
things work, but the emacs is holding open the pseudo-tty on stdin, stdout
and stderr, even though it's running on the X display. This keeps sshd
from closing, and that keeps ssh, and thus the script, on the host from
exiting. Redirecting all three to /dev/null fixes this.]
More information about the gnhlug-discuss
mailing list