LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Problem running emacs when su (https://www.linuxquestions.org/questions/linux-general-1/problem-running-emacs-when-su-24134/)

jkcunningham 06-23-2002 01:31 PM

Problem running emacs when su
 
I've had this problem off and on for weeks now and can't figure it out.
As a normal user I can run emacs and xemacs without any difficulties. As su I can sometimes run them and sometimes not. At the moment, not. Here's the error message I get when I try:

# emacs
Xlib: connection to ":0.0" refused by server
Xlib: Invalid XDM-AUTHORIZATION-1 key (failed key comparison)
emacs: Cannot connect to X server :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.

Does anyone know what's going on here?

Thanks.

jcunningham

rshaw 06-23-2002 01:48 PM

http://sdb.suse.de/sdb/en/html/maddin_xhost.html

jkcunningham 06-23-2002 02:22 PM

Thanks for the response.

I read the page on xauth and the man entry on xauth, and I think I understand roughly what your getting at. It looks like when I change to su, that su needs to have the authorization key in its xauth file before it is "allowed" to run any x-server applications. Is that correct? Seems like a slightly emasculated super user, but I guess that's beside the point. In any event, how do I do it? It wasn't entirely clear to me, and I'm afraid of breaking something. As su do I run xauth set <32-digit-key-from-xauth-list-as-user> or the other way around?

Seems like a lot of trouble when all I want to do is change my /etc/fstab file without using vi or logging off and logging on as root.

Furthermore, I have exactly the same distro at work (SuSE 8 pro) and emacs runs fine there in su, without ever having screwed with the xauth. What's the difference

Thanks again.
jcunningham

linuxcool 06-24-2002 05:01 AM

Start up a terminal window and run:

xhost +localhost

Then you can su to root and run emacs.

Or you can start up a terminal window and run:

xauth list $DISPLAY

This will print out a line that you will need to paste into the line below. su to root and enter:

xauth add <paste the line here>

Then you can run emacs.

jkcunningham 06-24-2002 11:00 AM

Thank you. I don't know yet if your suggestion will fix the problem or not, for without having done anything (I am aware of) the problem has gone away. Now I can run both emacs and xemacs as su. This has happened before. My guess is that next time I reboot the problem will reoccur. At that point I will try your suggestions.

I'd love to know what causes the change in behavior.

Thanks again.

linuxcool 06-24-2002 09:20 PM

You're welcome. :)


All times are GMT -5. The time now is 04:49 PM.