Question

I just installed an Ubuntu 10.10 desktop on a system to do some development work. I would like to run the X server environment on my MacBook instead of keyboard hopping (the graphics system on the Ubuntu box is not so great).

Poking around on the web I uncovered the following command that I can run from a terminal in Mac OS X:

/usr/X11/bin/Xnest -geometry 1280x900 :1 & DISPLAY=:1 ssh -X -Y grog@ubuntusys gnome-session

Note I have ssh set up so authentication happens automatically.

This seems to work great -- the Ubuntu desktop appears on my Mac OS X screen! (It seems to be smart enough to start X11 if it isn't running already). However if I try to open any program, it dies out. So close.

Any suggestions appreciated.

Update: Thanks to the answer below that provides a tutorial link I learned how to do basic X forwarding. You can do this from an X terminal window on the Mac simply like this:

ssh -X -Y username@targetsystem

then you can start X applications that run on the remote system but their windows are on the Mac X server. The issue that I now have is I want to start the gnome desktop session:

gnome-session

but the problem there is that the session takes over the whole Mac desktop. You cannot resize it or move it. Worse, the top part of the windows managed by the window manager end up underneath the menu bar that Mac OS puts up there so you cannot access those controls. I think this is a problem that Xnest was intended to solve, or am I misunderstanding what it is all about?

Was it helpful?

Solution

Depending on which version of OSX you're running, the best bet is probably the native Mac X11 Distribution. It's on the install CD (or if you're like me you got Lion through the App Store, it is available in the Utilities folder by default).

Launching it (Applications > Utilities > X11) brings up a specific X11 x-terminal, which you can use to ssh forward over to your Ubuntu system. That link in Answer 1 is pretty old, I found this one to be more helpful: http://www.craigryder.com/linux-ubuntudebetc/x11-forwarding-and-ssh-for-remote-linux-ubuntu-desktop/

The only extra option I use is the -C flag to enable compression when I run my ssh command. Please note that you do NOT have to run a full gnome-session to use the X features - you can simply run the program you want (ie, $ gedit&). This gets you out of using the whole desktop, but it is kind of weird since your Mac desktop still gets blacked out. You can find more on this technique @ http://ubuntuforums.org/showthread.php?t=1373823&page=2

I also noticed that on 10.10 Ubuntu, my system showed the same odd UI control behaviors you mention, but those disappeared when I upgraded my distribution to Ubuntu 11. I didn't really go to deep to see if simply upgrading X to the latest version on the 10.10 Ubuntu system would have fixed that issue, but I can confirm that it does not appear in 11.

One final note, this still seems to force the Mac X11 server into Full-Screen mode, but if you press COMMAND-ALT-A it immediately takes you out of the X desktop and back into your Lion desktop, which allows me to have both running and still be productive when I need to jump out of my Ubuntu system. I seem to be able to always access all the title and menu bars for all of my X apps just as though I was sitting at the Ubuntu desktop.

One caveat - I'm running the above to connect to a VMWare Workstation VM running Ubuntu (with 3D acceleration enabled) on my workstation - connecting to actual hardware may (though I can't fathom how) result in slightly different behavior.

Hope this helped!

OTHER TIPS

Use Xnest or Xephyr this way on your Mac OS X:

Xnest :1 -geometry 1280x800 -query 10.0.1.x

Xephyr :1 -screen 1280x1024 -query 192.168.1.x

The only thing you have to do is to enable remote login in your Linux by manually editing /etc/gdm/custom.cfg or using the gdmsetup GUI program. Here CentOS 5 is taken as an example. In Ubuntu things will be a little differrent.

This approach is very different to VNC which is like Microsoft's RDP (screen capture) while XDMCP utilizes the graphic power of your Mac to assist Linux system.

Remember that X11 was specifically designed to be used over network connections rather than on an integral or attached display device. X features network transparency: the machine where an application (the client application, for instance Firefox on Linux) runs can differ from the user's local machine (the display server, that is the X11 on your Mac). This approach allows both 2D and 3D operations to be fully accelerated on the user's local X server.

Is VNC not working for you? Or regular X forwarding over SSH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top