Setting up XDMCP for Mac

I just finished setting up a spare PC I had with Ubuntu on it. Thing is, it’s damn noisy so I want it stuffed up in the loft out of the way. This is fine because I can remote log-in to it using VNC, right? The answer would be yes if I made sure I was actually logged into my account on the machine – but that would mean having to get a monitor/keyboard/mouse up there to do so.

Alternative? XDMCP. It’s kind of like VNC, but allows you to connect to your machine if no one is logged in. I don’t know the technical what’s going on in the background, but I’ve managed to get this working on my Mac.

Enable XDMCP on Ubuntu

First of all you’ll need to enable XDMCP access on the Ubuntu machine. This is really simple to do:

  1. System > Administration > Login Screen Setup Menu
  2. Enter your administration password Enter Password
  3. Under the Security tab, Enable XDMCP Enable XDMCP
  4. You can then Close the window

X11 on Mac OS X

When I upgraded to Tiger, I didn’t install X11 which you’ll need to pull this all off. Fear not – it’s easy to install.

  1. Just slide in your Tiger install CD.
  2. When it’s in, scroll down the Finder window slightly and you’ll see Optional Packages or something similar.
  3. Run that app and install X11.

Connecting

Once X11 is installed, and XDMCP is enabled on Ubuntu, all that’s left is to actually connect.

  1. Open Terminal.app
  2. Enter in /usr/X11R6/bin/X -query XXX.XXX.XXX.XX where XXX.XXX.XXX.XXX is the IP of the Ubuntu machine
  3. A new app will open named Xquartz and a few seconds after you should see the Ubuntu login screen appear.

And that’s all there is to it! You’re then able to login and work on Ubuntu as if you were actually sitting in front of it. Expose even works which is really handy.

The only problem I’ve had is that it’s sometimes hard to switch between windows. If you’re having problems, just click on the Xquartz.app icon in the dock to get Ubuntu back.

When you’re finished, log out in Ubuntu and then switch to Terminal.app in OS X and hit CONTROL + C to quit Xquartz.app.

2005-12-08 [, , ]
  • Danny Sheaffer

    Thanks for the XDMCP pointer David. I did find you can enable the system hot keys so you can tab between apps. You set the following key…

    defaults write com.apple.x11 fullscreen_hotkeys -boolean true

  • NilsByte

    When i try to connect, i get the following error

    XFree86 Version 4.4.0 / X Window System (protocol Version 11, revision 0, vendor release 6600) [DRI] screen 0 installation complete Screen 0 added: 1280×800 @ (0,0) Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!

    the Xquartz icon comes up in the dock, but no window opens. can you tell me where is the error?

  • NilsByte

    When i type the same command in an xterm window, the following messages display:

    XFree86 Version 4.4.0 / X Window System (protocol Version 11, revision 0, vendor release 6600) _XSERVTransSocketCreateListener: failed to bind listener _XSERVTransSocketINETCreateListener: …SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: failed to create listener for inet6 _XSERVTransSocketCreateListener: failed to bind listener _XSERVTransSocketINETCreateListener: …SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: failed to create listener for inet [DRI] screen 0 installation complete Screen 0 added: 1280×800 @ (0,0) Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!

  • Cedric

    HI, very good tip here, but maybe you can help on my issues with XDMCP on macbook. I have a Ubuntu PC from wich I’d like to log on from a mac through XDMCP.

    the XDMCP works fine, i can reach Ubuntu with the “-query” command, I can log on through Gnome BUT after this, the keyboard of the mac book is not anymore recognize as macbook, and I can’t change the mapping of this, means whatever I try un gnome, the A is=, the B is – etc….

    Spent days and nights on this, i didn’t find any start of a solution.

    Do you have an idea of where and how i can configure this ? The weard thing is when I log on, to type login and pwd the keybord works fine…

    thanks for helps !

    C.

  • Jim

    Yes, I had the same problem as C., which is why I downgraded to Ubuntu 6.06. Would be great to find a solution so I can go on to the latest version of Ubuntu.

    Regarding some of the other users’ problems: I had similar issues at first, until I realized that I needed to forward the appropriate ports on my NAT-type router (or make sure the firewalls are open on those ports, if the computers are local to each other). I forget at the moment which port XDMCP uses, but it’s easy to look that up.

  • DeepBlade

    I have the same problem as Cedric and Jim.. This is so bad…. I did a LOT of research as well and tried changing xorg.conf in many different ways. Nothing helped.

    Here are links to stay informed just in case someone finds a solution somewhere: http://ubuntuforums.org/showthread.php?p=1772187 http://ubuntuforums.org/showthread.php?p=3060080

  • Cedric

    Well, then it’s not because I did something wrong… good to know. Anyway, I looked also at the X11 conf under MAc OsX. but I can’t see somehing wrong.

    DeepBlade seems to be abble to make it work under SSH. that can be an alternative.

  • KeithH

    Use the xev command to monitor key events. That’ll help you understand what’s going on. What sort of changes did you make to xorg.conf? What XkbModel and XkbLayout settings does the Mac X configuration use?

  • Jack Rickard

    Yes. Same problem. Once I am on the Ubuntu 7.04 machine, which looks gorgeous with the MacBook Pros 1920×1080 graphics, the keyboard is a mess. Whatever I press, something else comes up.

    Jack Rickard

  • King

    Anyone found a solution to this? The keymapping is driving me nuts. And to the people having issues with the fonts, just install XFS. That is what fixed it for me

  • blah

    Well here’s a partial fix to the keyboard problem.

    ssh -X in to the ubuntu machine. Run the following command all on one line:

    xmodmap -pke > $HOME/.xmodmaprc ; printf “xmodmap $HOME/.xmodmaprc” > $HOME/fixmykeys ; chmod 777 fixmykeys

    Now the next time you remote in, just double-click the fixmykeys file on your desktop and run it. That will fix everything… Except the shift key… which seems to act as an ALT key. Only strange thing there was I was in vi and habitually hit an esc :wq and the colon (shift – ;) worked. Very strange. Maybe the shift key is both “shift” and “alt” at the same time? Still very annoying without being able to shift.

  • blah

    Oops, I knew I’d mess that up. That puts the fix file in your home folder. Run this command instead if you want it on your desktop:

    xmodmap -pke > $HOME/.xmodmaprc ; printf “xmodmap $HOME/.xmodmaprc” > $HOME/Desktop/fixmykeys ; chmod 777 fixmykeys

  • blah

    Actually that won’t work either! Run this to set the permissions correctly:

    xmodmap -pke > $HOME/.xmodmaprc ; printf “xmodmap $HOME/.xmodmaprc” > $HOME/Desktop/fixmykeys ; chmod 777 $HOME/Desktop/fixmykeys

  • JE

    I found this workaround, which works for me:

    http://sudan.ubuntuforums.com/showthread.php?t=396308

    In summary, go to System Preferences -> International -> Input Menu

    Then check both US and US Extended keyboard layouts

    Check the option to show input menu in menu bar

    run /usr/X11R6/bin/X -query host

    log in

    then switch keyboard layouts from US to US Extended

    Enjoy a functional keyboard in gnome. Note that when you start up X, it reverts to the US keyboard layout, so you have to make this switch every time.

  • Phiippe

    Instead of running a script to correct the mapping after every start it is also possible to move the keymap (xmodmap) to .Xmodmap in the home directory. X11 will automaticly include it…

  • wonger

    If you are getting this message repeatedly, it could mean that your linux box is not at run level 5. I am using rhel4 and was able to get the logon screen once I issued telinit 5.

    XFree86 Version 4.4.0 / X Window System (protocol Version 11, revision 0, vendor release 6600) [DRI] screen 0 installation complete Screen 0 added: 1280×800 @ (0,0) Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!

  • http://deepblade.blogspot.com DeepBlade

    wow, it works!! Thanks JE.

    One other thing I want to point out is that: if the “/usr/X11R6/bin/X -query ” command doesn’t seem to bring up the login screen for ubuntu, you might have to go back into ubuntu and go to: system -> administration -> login window

    Go to the Remote tab, and change the style to plain.

  • Allen Geer

    So to fix the stupid keyboard issue.. You simply have to create the .xmodmaprc file in your home directory.

    So in Mac OSX you run: ssh -X

    then after logging in you run xmodmap -pke > $HOME/.xmodmaprc

    That’ll get you part of the way there. You have to fix the shift key issue by adding this to the beginning of the generated .xmodmaprc clear shift clear lock clear control clear mod1 clear mod2 clear mod3 clear mod4 clear mod5

    and then add this to the end: add shift = ShiftL ShiftR add lock = CapsLock add control = ControlL ControlR add mod1 = AltL add mod2 = NumLock add mod3 = Modeswitch add mod4 = MetaL add mod5 = ScrollLock

    Save the file. Exit your ssh session. Run the following from Terminal X -q

    Everything should work after you login. If it asks to load your .xmodmaprc file then you need to do that (move the file to the left hand window and hit okay)

  • Allen Geer

    ack, the editing is all screwed up. Make your .xmodmaprc beginning and end look like this one:

    http://lassauge.free.fr/cygwin/.xmodmaprc

  • http://farmsidesystems.com Gene Loriot

    GOD BLESS ALL OF YOU. Have been running around like a chicken sans head, got Mac fever, am A Solaris Systems Adminstrator, needed to marry the two. this makes a full desktop with multiple login capability work perfectly. All I needed was to plug in a 3 button mouse and I am, on my Macbook, sitting at my SPARC Solaris desktop(s). PERFECT. Thanks!

  • Andrew

    Dunno if this hits up anybody else, but MAKE SURE YOU USE TERMINAL as specified by Dave.. if X11 is open (which I had because I was running wireshark to figure out why nothing would happen) xdm won’t work.

    Hope this saves somebody the hour it took me to figure out.

  • Samar

    Hi,

    That was a very informative article. But I wonder, is the inverse possible ? Logging into a MAC from an Ubuntu machine ?

    Thanks

blog comments powered by Disqus