Get remote X Windows working in Ubuntu Karmic

One thing that troubled me moving to Ubuntu 9.10 Karmic Koala: my remote X applications stopped working with the error
X11 connection rejected because of wrong authentication


The reason seems to be that Gnome moved the location of X authorization to [wherever-the-hell-i-dont-remember], whereas ssh and everything else still use the same location (~/.Xauthority). Note: I clearly forgot whatever it was I discovered about xauth, so please enlighten me in the comments, and I will update this exceedingly lame paragraph.

This is going to be tagged as an Emacs post because my principal reason to use remote X is Emacs’ awesome make-frame-on-display command.

The bash script I use is saved in ~/bin/xauthmagic:

1
2
#!/bin/bash
xauth -f ~/.Xauthority list | grep -v ':0' | while read foo; do xauth add $foo; done

This means: look through all the xauth cookies in ~/.Xauthority, remove the ‘:0′ (local) display cookie, take the remaining cookies and run the xauth command on them.

The steps I take to use this:

  • On my remote host (emunah), start an ssh section forwarding X:
    greg@emunah$ ssh greg@maui -Y
  • On my local host (maui), run the xauthmagic script above

    greg@maui$ ~/bin/xauthmagic
  • From my local host emacs, run M-x make-frame-on-display RET localhost:10.0 RET

Et voilá!

This entry was posted in Development, emacs. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

5 Comments

  1. erikr
    Posted November 10, 2009 at 10:29 pm | Permalink

    Greg, I have this same problem, too. Is this xauth stuff really the “official” solution? I unfortunately know nothing about xauth.

    I can ssh to my remote box with X forwarding and run “xeyes” just fine, and even emacs runs fine. My only problem is when I run emacsclient and try to create a new frame, I get the same error as you… I will try your solution! Thank you!

    P.S. Everything did work fine until the upgrade to karmic…

  2. Posted November 12, 2009 at 9:28 am | Permalink

    @erikr, I have logged on to several Linux machines to determine their default Xauthority database location, using xauth -v. On Debian machines, I always get ~/.Xauthority. I get that result even on a server that has been upgraded to Karmic, but which does not have Gnome. On my laptop, however, I get /var/run/gdm/auth-for-gregj-3sy6gB/database. That path changes every time I log in, with different salt. Since everything else looks to your home .Xauthority file, this causes your emacsclient session to fail to authenticate.

    I might try messing around with setting the XAUTHORITY environment variable, but I’m not sure that would work for Gnome.

  3. Posted January 21, 2010 at 2:34 pm | Permalink

    Howdy,

    I’ve been working on this same problem too. I submitted an Emacs
    bug(#5434) and was given this explanation by one of the respondents:

    ,—-
    |
    | > Okay, I’ll try that, but a quick question: should an xauth problem result
    | > in failures for every X application I try to run? Other applications
    | > (other than emacsclient) run just fine.
    |
    | There is a difference. When you start other clients, you do it from
    | the shell started by the ssh login process. When you do emacsclient
    | -c it only tells your emacs daemon to open a frame on your DISPLAY.
    | The emacs daemon is not started from your ssh shell.
    |
    | Try starting another X client from a shell not related to the ssh
    | shell with the ssh-forwarded display (localhost:10) and see what you
    | get. You should get permission denied. But your Emacs daemon may
    | have other displays opened, that can influence matters also.
    `—-

    All my machines (two Fedora 12, one Ubuntu Karmic Koala) have the
    newest gnome, and I confirm the same bizarre xauth locations as you
    do.

    I’m at least glad I’m not the only one!

    Joel

  4. Posted January 21, 2010 at 2:39 pm | Permalink

    It works!

  5. Posted July 29, 2010 at 11:38 am | Permalink

    I am not absolutely certain this is correct, but it has worked for me.

    The problem I wanted to solve was to ssh from my laptop to a ubuntu server and then invoke emacsclient to obtain a x window’s frame on my lap top served up from the emacs running on the ubuntu server. The xauth inside emacs is the one into which I needed to add the xauth credentials. The following worked, at least once :)

    This script resides on the ubuntu server is run after you ssh to the server, forwarding your
    laptop’s X display.

    #!/bin/bash
    
    # First we need to add to xauth of the server emacs
    # permission to throw up windows on our X server.
    # But .Xauthorization accumlates so we have to auth
    # more than you'd think.
    xauth -f ~/.Xauthority list | grep -v ':0' | while read foo; do
      emacsclient -e "(shell-command \"xauth add $foo\")"
    done
    
    # Ok, now we should now be able to connect.
    emacsclient -c
    

    Thanks for the hint!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
  • randy moss combine results
  • tea party zombies download
  • search 78search 800 numbers
  • randy moss bio
  • dis systems
  • archos
  • randy moss yahoo stats
  • roses
  • dis quand reviendras-tu
  • xanadu bengals
  • zara phillips and the queen
  • 4pm cspancspan area 51cspan 90.1
  • freida pinto miral
  • search lsu.edu
  • mtv oddities
  • seagate
  • battleship aurora
  • greg olsen university of miami
  • mtv kings of leon
  • chad ochocinco sisterchad ochocinco twitter
  • tolerance
  • search engines cookiessearch engines definition
  • bonus
  • gears
  • hartmann
  • dis 0 0.9
  • vince young yahoo stats
  • radar
  • beers
  • search 2.0
  • homeless
  • dis boards cruise
  • search engines us
  • chad ochocinco johnson
  • bengals qb situation
  • gregg olsen books
  • zara phillips dating
  • vince young uncle rico gif
  • freida pinto green dress
  • bea luna
  • chicago bears media relations
  • framed
  • la ink 2011 season 5
  • deed
  • battleship vittorio veneto
  • di's hallmark
  • meant
  • chicago bears 61
  • vince young depression
  • cspan hosts
  • ratchet
  • new england patriots gillette stadium
  • chicago bears 08 record
  • chicago bears bleacher report
  • battleship yamato wreck
  • chicago bears training camp
  • la ink corey
  • chicago bears 1985
  • search engines watch
  • search engines questions
  • pendant
  • cspan facebook
  • connecticut renaissance faire
  • battleship egg hunt
  • serenity
  • kilo
  • bangles eternal flame mp3bengals forum
  • prairie
  • afternoon
  • greg olsen vikingsgreg olsen wife
  • springhill
  • tea party birthday
  • vince young quiz
  • bea zuberbühler
  • battleship ipad
  • betty
  • search engines of the world
  • bea 0b0 105
  • dis x
  • chicago bears tattoos
  • greg olsen vancouver
  • hp support 530
  • chicago bears expo
  • quran
  • legend
  • search engines 9
  • 60 search engines virus
  • zara phillips baby
  • freida pinto zac posen
  • connecticut education
  • battleship yamato 2010
  • search vim
  • hp support error 1005
  • pads
  • connecticut post
  • mtv executivesmtv fantasy factory
  • connecticut secretary of state
  • search 990 finder
  • rooster
  • homeowners
  • wein
  • chicago bears 96
  • vince young yahoo stats
  • worst
  • c span yesterdayc span zelaya
  • randy moss jail
  • new england patriots 98.5
  • hp support quick test pro
  • zara phillips baby
  • la ink games online
  • chicago bears pictures
  • chad ochocinco bears
  • zara phillips wedding hat
  • chad ochocinco vs skip bayless
  • chad ochocinco and cheryl burke
  • new england patriots jake locker
  • tijuana
  • hp support englandhp support forum
  • bengals arrests
  • c span video contest
  • mtv dougie
  • new england patriots 80
  • tea party zombies download
  • vince young redskins
  • cspan presidents
  • palma
  • bear gryllsbea hive dance studio
  • zara phillips kids
  • battleship galactica
  • randy moss 98 vikings
  • beagle
  • extending
  • hp support id
  • connecticut 5th district
  • vince young football camp
  • search tumblr
  • la ink cast
  • search 32
  • battleship wilmington nc
  • randy moss 07 08 highlights
  • hose
  • dis pater
  • crimper
  • la ink 03x05
  • mandolin
  • hp support 6500a plus
  • battleship bismarck wreck
  • search engines before google
  • cspan washington correspondents dinner 2011
  • reign
  • chad ochocinco quotes video
  • bea goldfishberg
  • dependency
  • spherical
  • coronado
  • randy moss vikings 2011
  • battleship lexington
  • mtv true life
  • vince young endorsementsvince young foundation
  • hiding
  • search and seizure
  • search engines usage statistics 2010
  • connecticut lottery
  • dressing
  • licensed
  • mtv overdrive
  • tea party nj
  • hp support chat
  • hp support greece
  • connecticut juvenile training schoolconnecticut kids
  • hp support error 1005
  • dis lyrics
  • bea 71 series staples
  • odessey
  • bea test
  • mtv 5 cover
  • new england patriots needs
  • la ink 04x01
  • vince young 99 yard video
  • rotation
  • search operatorssearch people
  • battleship hacked
  • bea verdi
  • zara phillips fascinator