LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-13-2004, 05:42 PM   #1
flieslikeabeagl
LQ Newbie
 
Registered: Sep 2004
Distribution: Gentoo, Slackware, Mepis
Posts: 5

Rep: Reputation: 0
cannot open X apps from a root console window


Hi, I have Slackware 10.0 running on my AMD Duron 1300 box. While logged in as a normal user, I often open up a terminal window and use "su" to become root to run some administrative task. My problem is that I cannot open any GUI application while in this mode. As an example, when I try to run the Guarddog firewall app, I get errors like this:

Code:
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
guarddog: cannot connect to  X server :0.0
If I log directly into KDE as root, I have no such issues; but I know that running KDE as root is a Very Bad Thing (TM) to do.

Presumably this is due to the configuration of the X server in Slackware. Anyone know how to fix this issue?

TIA,
-Flieslikeabeagle
 
Old 10-13-2004, 06:16 PM   #2
AltF4
Member
 
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 31
probably the $DISPLAY veriable is lost while "su"-ing

either set it manually ( "export DISPLAY=unix:0.0" ) or
use a version of su that supports the DISPLAY variable
(in SUSE i use the "/usr/X11R6/bin/sux" script)
 
Old 10-13-2004, 07:03 PM   #3
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
You own the display and root isn't allowed to use it. Try;
$ xhost +
$ su
# <some X app>

"Much Better" way to to setup yourself to use sudo. Then;
$ sudo gvim /some/file

For sudo capabilities, as root do;
Add yourself to the wheel group. Then;
# visudo
uncomment this line.
%wheel ALL=(ALL) NOPASSWD: ALL

press <esc>
then <shift :>
then <wq>

Log out and back in.

Now you can sudo.

See... everyone should know vi/vim.
 
Old 10-13-2004, 08:47 PM   #4
flieslikeabeagl
LQ Newbie
 
Registered: Sep 2004
Distribution: Gentoo, Slackware, Mepis
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the replies, folks. I'm at home now, but will try out your suggestions tomorrow when I'm back in front of the offending PC.

-X-, I downloaded and compiled from source the tarball for the Gnu Nano editor. Nano and FreeBSD's "ee" (easy editor) are the only two command line *nix editors I've run across that are compatible with my brain...my chances of remembering to "esc, shift, colon, w, q" every time I want to save a file are about as good as a snowballs in a lava flow. I actually had no choice other than to use vi for several years back in the early 90's, on Sun Sparkstations running Unix. When X and Solaris came along, a GUI text editor came with it. I have never been happier to stop using any piece of software than I was when I abandoned vi!

Don't get me wrong, I'm glad you enjoy vi. But its not for me - its for people who can mentally map extremely arbitrary key sequences to the simplest tasks a text editor might be asked to perform!

-Flieslikeabeagle
 
Old 10-13-2004, 08:49 PM   #5
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 52
You should try mcedit (the Midnight Commander editor) it's VERY easy to use. Just type: mcedit filename once you're in just edit as you like and hit ESC If you need to do something like search or replaze look at the bottom that you've a list of commands that are executed with the F* keys ie: F2 = Save, F4 = Replace.
Oh and it comes installed with a default Slackware install

Last edited by gbonvehi; 10-13-2004 at 08:51 PM.
 
Old 10-14-2004, 04:42 AM   #6
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30

I understand, but there are times when you need to know vi/vim like visudo. Sure you can use nano else, but visudo is there for a purpose.
 
Old 10-14-2004, 11:28 AM   #7
tobyl
Member
 
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 767

Rep: Reputation: 62
I like pico, but then is that similar to nano?

Anyway my post is to draw flieslikeabeagl's attention to kdesu. It is X session aware, and helps me out sometimes. (It will start gtk apps as root too).
 
Old 10-14-2004, 02:05 PM   #8
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
kdesu is a great GUI tool, but when you're at the command line sudo is really useful.
 
Old 10-15-2004, 02:13 PM   #9
flieslikeabeagl
LQ Newbie
 
Registered: Sep 2004
Distribution: Gentoo, Slackware, Mepis
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks, guys! Both the "xhost+" trick and "kdesu" are working for me. Much appreciate the help. I just slapt-got (!) mc, and took a look at mcedit, it certainly seems as user friendly as you can get on the command line (does it use ncurses?).

tobyl, I believe nano is designed to be very close to pico .... something to do with pico not being GPL licensed, I believe.

-Flieslikeabeagle
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to open apps when 'su'ing to root from user account ganja_guru Linux - Software 3 06-03-2005 10:51 AM
Javascript - what to use rather than window.close() then window.open() davee Programming 2 04-11-2005 08:28 AM
Where have all my console apps gone? JordanH Red Hat 2 11-01-2003 09:14 PM
Apps wont open as user but will as root slewis1972 Linux - Software 1 10-25-2003 12:07 PM
X apps from console after su tobyl Slackware 14 04-16-2003 04:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:26 PM.

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