LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 12-05-2008, 02:18 AM   #1
santiagosilva
Member
 
Registered: Jan 2004
Posts: 214

Rep: Reputation: 30
running programs as root in a terminal


Hello folks

I just upgraded to fedora 9 (from fedora 7)
and (amongst many things) i can't seem to run X-programs from a shell while being logged in as root.

For example, i used to run kTorrent from a shell, while being logged in as root in the terminal, and as the user in X-win. Now that program doesn't open when i do that.

When i run #ps
i do see the process listed. and if i type kTorrent again, i'll get yet another process called torrent in the ps list.

is there a variable somewhere or a setup thing that i'd need to change for this?

please let me know asap

thanx
//S

Last edited by santiagosilva; 12-05-2008 at 05:03 AM.
 
Old 12-05-2008, 07:56 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
I can think of at least two possible reasons for this to happen. Since you didn't provide any error messages I will address both problems.

Issue the following command when you first open the terminal and while you are still logged in as the normal user.
Code:
xhost +local:
Issue the following command after you you have logged on as root using su or sudo -i.
Code:
export DISPLAY=":0.0"
The first command allows your desktop manager to accept connect requests from other processes running as other users on the same machine. That means that root is allowed to create a window on your desktop.

The second command tells root's environment to open X windows on the local display named 0.0. It is possible to have several concurrent displays on one machine although it is unusual.

Last edited by stress_junkie; 12-05-2008 at 08:00 AM.
 
Old 12-05-2008, 11:38 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
If you use "su -" to enter the root shell it should carry over your current user's environment. You may still have to allow localhost to connect to x though.

Another option is to run "kdesu program-name" (or gksu in gnome) as your normal user, which will launch the program with the graphical "run as root" dialog.

BTW, why on earth would you want to run ktorrent as root anyway? That's not the kind of program that normally needs, or should have, administrative privileges.

Last edited by David the H.; 12-05-2008 at 11:40 AM.
 
Old 12-05-2008, 12:58 PM   #4
santiagosilva
Member
 
Registered: Jan 2004
Posts: 214

Original Poster
Rep: Reputation: 30
Hello,

I don't get any error messages that's the thing.

# > ktorrent
[1] 3325
# >
# >ps
PID TTY TIME CMD
3298 pts/1 00:00:00 su
3301 pts/1 00:00:00 bash
3325 pts/1 00:00:00 ktorrent (or kopete)
3326 pts/1 00:00:00 ktorrent (or kopete)
3330 pts/1 00:00:00 ps
# >

the "xhost local" and the gksu didn't work.
the first options had the same result as before. (no messages no nothing..)

and when i try to use gksu or kdesu, it says those programs don't exist. and i can't find them when i try to install them.


(It's just i'm used to navigating and running programs and what not willy nilly is all. that's why i like doing it that way.)


thanx folk
//s
 
  


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
[openbsd]Building and running Java programs in terminal. LinuxNewbie999 *BSD 1 09-02-2008 11:40 PM
LXer: Running Terminal Programs in the Background with Screen LXer Syndicated Linux News 0 08-24-2006 06:54 PM
Can't run paticular programs as root terminal -- Slack 10.2 W0bbles Linux - Software 5 03-30-2006 12:11 PM
fluxbox user menu open terminal with root programs? darkleaf Linux - Software 2 10-14-2004 05:44 AM
running programs as root mehesque Linux - General 16 06-09-2004 04:18 PM


All times are GMT -5. The time now is 05:10 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration