LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-22-2004, 03:33 PM   #1
svarreby
Member
 
Registered: Nov 2003
Location: Hudiksvall, SWEDEN
Distribution: Slackware 10.1
Posts: 70

Rep: Reputation: 15
Start a text editor as root?!?


Often when I have to get root access I use a text editor (if it's a lot of text /cut/paste etc) otherwise I use VI. When I call for a editor in a terminal:

kate etc/fstab

... it fails, and says that it can't load (or get access to) the X-server (or something similar) ... and YES, I am root ...

Is it possible to click my text editor's icon and then automatically get root priviligies (after passed the password) ???

If your answer is NO on this question ... what do I have to "fix" so that my example command above (kate etc/fstab) do start the editor when working in a terminal ???
 
Old 02-22-2004, 03:42 PM   #2
Booster
Member
 
Registered: Sep 2003
Location: Ontario, Canada
Distribution: Gentoo, Suse
Posts: 59

Rep: Reputation: 15
do (as your normal user):
#xhost localhost

It should then let you launch the progs as another user (any other user from your local machine)

Cheers!
 
Old 02-22-2004, 03:54 PM   #3
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
you may also have to change the DISPLAY variable, type "export DISPLAY=0.0" after typing xhost localhost as the standard user like booster said. Note: The export command should be types in the terminal while logged in as root.

another alternative is rather than typing su - or su the way you likely are type su root which will give you root privlages but will transfer all your display stuff w/ it, however there are a few limitations, but you will not likely encounter them.
 
Old 02-22-2004, 05:25 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
mucking around with xauthorities in this way
is not recommended, though. a reasonably
safe approach would be to do as follows from
an xterm ... (if X forwarding is enabled in sshd_conf)

Code:
ssh root@localhost "kate /etc/fstab"

Cheers,
Tink (paranoid) ;D
 
Old 02-23-2004, 05:03 PM   #5
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
OK, maybe it's me, but in my experience this is a KDE thing. You apparently can't open Kate, KWrite or KEdit in a terminal, as root or otherwise.

(I'm a GNOME user normally, so I notice these things.)

This appears to be why there is a "File Manager (Super User)" shortcut prominently placed in the menu (unlike in most other WMs/DEs, where if you want such a shortcut you have to make it yourself. For that purpose, I use a utility called gksu, whose purpose is to pop up the authentication box for entry of the root password, and then call the program when you hit Enter or click OK). I believe that KDE users are expected to browse to their file with the SU Konqueror FM and then right-click and choose "Open With". At least that's the only way I've ever found to do it.

Which is why I don't use those text editors, but rather one that does allow me to actually type its binary name into a terminal to be opened. In other words, any other one than a K-tool (gedit, joe, nano, pico, take your pick).

Like I said, maybe it's me.
 
Old 02-23-2004, 06:40 PM   #6
Allen614
Member
 
Registered: Dec 2002
Location: Plains
Distribution: Slackware 13
Posts: 465

Rep: Reputation: 30
Try using the full path.
 
Old 02-23-2004, 09:44 PM   #7
smith847be
Member
 
Registered: Jun 2003
Location: Hanover, New Hampshire, USA
Distribution: Debian Sid (Unstable)
Posts: 143

Rep: Reputation: 15
Quote:
Originally posted by motub
OK, maybe it's me, but in my experience this is a KDE thing. You apparently can't open Kate, KWrite or KEdit in a terminal, as root or otherwise.

(I'm a GNOME user normally, so I notice these things.)

This appears to be why there is a "File Manager (Super User)" shortcut prominently placed in the menu (unlike in most other WMs/DEs, where if you want such a shortcut you have to make it yourself. For that purpose, I use a utility called gksu, whose purpose is to pop up the authentication box for entry of the root password, and then call the program when you hit Enter or click OK). I believe that KDE users are expected to browse to their file with the SU Konqueror FM and then right-click and choose "Open With". At least that's the only way I've ever found to do it.

Which is why I don't use those text editors, but rather one that does allow me to actually type its binary name into a terminal to be opened. In other words, any other one than a K-tool (gedit, joe, nano, pico, take your pick).

Like I said, maybe it's me.
Motub,

No offense at all or anything - i know you use GNOME - , but that's not quite true about KDE. KDE has a nearly identical utility to gksu; it's called kdesu. If you run 'kdesu [whatever]', then that pops up an authentication window and runs the thing as root. Also, under both Run Command...->advanced and the Menu Editor, there is an option that you can fill in to 'Run as a different user'. By the way, that's all that the "File Manager (Super User)" shortcut is; it's nothing special - it's just convenient that KDE comes with it by default.

Last edited by smith847be; 02-23-2004 at 09:47 PM.
 
Old 02-24-2004, 08:04 AM   #8
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
Why would I be offended? It's good to know that there is a similar utility for KDE, as I find gksu invaluable. So that means that the original poster can use it to create shortcuts or panel entries to point to Kate or whatever, I would assume. That is then one answer to the original question, but does not explain why I can type "gedit" in a terminal and have gedit open, but if I type Kate, kate, or any of the K text editor binary names in a terminal, I get a not found error and the program doesn't open. Are the K-tools not in my $PATH$ or something?

Oh, and apologies for any weird formatting in this post; it's the first time I've used lynx to post on any forums, and I'm not such a lynx master (as nice as the browser is) that I know how to avoid any possible mistakes.
 
Old 02-24-2004, 05:30 PM   #9
smith847be
Member
 
Registered: Jun 2003
Location: Hanover, New Hampshire, USA
Distribution: Debian Sid (Unstable)
Posts: 143

Rep: Reputation: 15
motub,
"Why would I be offended?" - I don't know, I just don't want people to feel insulted or whatever if I correct them. Nevermind. That's weird, though, that you'd get not found errors in a terminal; And you can launch it just fine by a menu or 'run command...' box? All the distros I've heard about install KDE apps in the same place as the rest of the user program executables (usually /usr/bin). Try just doing a 'locate kate' command. Then take a look at 'echo $PATH', and see if the directory is listed. Except that the menus and stuff should be using the same PATH variable for launching. That's weird. And just to make sure I'm interpretting right, the not found error is saying that the binary is not found? (not e.g. that the QT lib files aren't found - since that's common)? P.S. there's no weird formatting in your post.
 
Old 02-25-2004, 04:54 AM   #10
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
OK, I tried it with the full path to the binary, and that works. Huh, so does it work with just the binary name.

A 3.2.0 improvement, maybe? Because it really didn't work under 3.1.something.
 
Old 02-25-2004, 06:48 AM   #11
ringwraith
Senior Member
 
Registered: Sep 2003
Location: Indiana
Distribution: Slackware 15.0
Posts: 1,272

Rep: Reputation: 65
That is one of the nice things about pico. You can cut and paste into it with no problem (if you have GPM correctly configured) and since it is not a gui text editor you have no problems starting it as root.
 
  


Reply



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
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM
Can't open text editor as root - SuSE 9.2 dcdbutler SUSE / openSUSE 9 02-17-2005 04:38 PM
text editor dauphinfay Linux - General 2 02-29-2004 09:37 PM
Best Text Editor? Ekim Gram Linux - Software 4 05-24-2003 12:36 PM
vi text editor keevitaja Linux - Newbie 4 08-23-2002 03:13 PM

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

All times are GMT -5. The time now is 02:05 AM.

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