Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-07-2005, 04:31 PM   #1
Registered: Jul 2005
Location: Wisconsin
Distribution: Slackware 10.2
Posts: 35

Rep: Reputation: 15
can't run emacs as root

alright, thread title pretty much says it all. when i log in as root to edit a file (configuration files and what not) (note that i don't do this often, as i'm still a bit of a newb)... when i su to root, and enter emacs /etc/lilo.conf, this is what i get:
bash-3.00# emacs /etc/lilo.conf
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

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.

i'm not sure if this is just because i'm trying to run a window program on the x server when i'm logged in as a different user, but whatever the case, i'd just like a little fix up here if there is one. i already did what i needed to in lilo.conf, but using JOE, but i'm not familiar enough with all of the commands in emacs or vi to use the console portions of them. thanks.


note: i'm using slackware 10.2, with kernel version 2.4.31
Old 10-07-2005, 05:54 PM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
i'm not sure if this is just because i'm trying to run a window program on the x server when i'm logged in as a different user, ...
That's exactly what it is
It's X's permission-based method of handling access to a display. The short of it is, you can allow anyone to connect to the display by running (as the regular user):
xhost +
Then you should be able to open a window for emacs with root. Actually, that will apply to all graphical apps under X.

As another option, root can run emacs like this:
emacs -nw
That will start emacs in the console rather than trying to open a new window.

You can always read up on xhost with man xhost. If your machine is on a network, I'd advise you do. The xhost command above might prove to be "too much" in a networked environment. If it's a stand-alone home PC, then its fine.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I don't want emacs to run as a window! mimithebrain Linux - Software 3 11-07-2005 04:39 PM
how can I run my perl scripts in emacs linjia Linux - Software 1 12-05-2004 10:30 AM
cant use emacs in root any more? |2ainman Linux - General 1 04-19-2004 09:07 PM
Emacs is there but wont run! aromes Linux - Software 1 09-29-2003 03:21 PM
run sqlplus under emacs fei Linux - Software 0 08-18-2003 01:34 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration