[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mounting CDs? and emacs under SU?



on Sun, Sep 02, 2001 at 08:56:20PM -0400, Peter Christensen (christensen@gtcinternet.com) wrote:

> This is how I did it (I think!) before my hard drive crashed and I had
> to replace it.  Now that I've reloaded Linux I can't edit /etc/fstab
> with emacs.  Emacs works OK with a normal signon, but under SU I get the
> following messages:
> 
>   Xlib:  connection to ":0.0" refused by server
>   Xlib:  Invalid MIT-MAGIC-COOKIE-1 key
>   emacs:  Cannot connect to X server :0.0
>   check the display environment variable or use "-d"
>   Also use the 'xhost' program to verify that it is set to permit
> connections from your machine

The problem here is how you're going root, and your X authentication.

I'd highly recommend sudo over su for gaining root access, even if it
only means you're doing 'sudo -s' (or 'sudo su -' as I do) to gain a
full root shell.  There's been past discussion here of benefits (and
criticisms, notably by Ethan Benson).  If you're going to use su, add
the '-' argument to get a login (fully initialized) shell.

The X access issue has to do with your MIT-MAGIC-COOKIE.  

Do ***NOT*** use 'xhost' to provide access to your X session, this is
highly dangerous.  Though, more recently, forbidding remote X
connections with the -nolisten option is becoming a default.

To allow X access to a specific dispaly:

  - Set your DISPLAY variable appropriately.
  - If root, merge your .Xauthority file with that of the user running
    the X session, e.g.:

      $ xauth -merge ~peter/.Xauthority

This should allow launching X clients to the display.

The message you cite should be filed as a bug against emacs, it is
providing outdated, dangerous, advice.

Cheers.

-- 
Karsten M. Self <kmself@ix.netcom.com>          http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?             There is no K5 cabal
  http://gestalt-system.sourceforge.net/               http://www.kuro5hin.org
   Free Dmitry! Boycott Adobe! Repeal the DMCA!    http://www.freesklyarov.org
Geek for Hire                        http://kmself.home.netcom.com/resume.html

Attachment: pgpUTAIC_B8OM.pgp
Description: PGP signature


Reply to: