LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 08-24-2009, 05:15 AM   #1
mahdif
Member
 
Registered: Sep 2006
Distribution: Slackware
Posts: 75

Rep: Reputation: 15
Run an app as root. Impossible!


In mandriva 2009 I couldn't find any method to run a program as root. Even using the konsole window I can't launch any app as root using either sudo or su. Do you have the same problem?
 
Old 08-24-2009, 05:24 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Have you tried either one of the following?
Code:
$ su -    ### the - forces su to act  as a login shell
          ### so that the PATH environment variable is
          ### updated for root
$ su -c "/path/to/command"
          ### this should execute the given command as root
 
Old 08-24-2009, 05:28 AM   #3
mahdif
Member
 
Registered: Sep 2006
Distribution: Slackware
Posts: 75

Original Poster
Rep: Reputation: 15
Yes, it doesn't work!

Last edited by mahdif; 08-24-2009 at 05:50 AM.
 
Old 08-24-2009, 05:30 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Did you get some error message?
 
Old 08-24-2009, 09:57 AM   #5
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
su -c doesn't use root's path environment variable like su -, it uses the users' path.

Code:
[surfer@localhost ~]$ su -c /sbin/ifconfig                                                      
Password:                                                                                       
eth0      Link encap:Ethernet  HWaddr 00:E0:4D:27:A3:A6                                         
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0                      
          inet6 addr: fe80::2e0:4dff:fe27:a3a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1077410 errors:0 dropped:0 overruns:0 frame:0
          TX packets:934414 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1145147190 (1.0 GiB)  TX bytes:126784109 (120.9 MiB)
          Interrupt:16 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:72764 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72764 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4307825 (4.1 MiB)  TX bytes:4307825 (4.1 MiB)

[surfer@localhost ~]$ su -c ifconfig
Password:
bash: ifconfig: command not found
[surfer@localhost ~]$ su -
Password:
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:E0:4D:27:A3:A6
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:4dff:fe27:a3a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1077415 errors:0 dropped:0 overruns:0 frame:0
          TX packets:934420 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1145147514 (1.0 GiB)  TX bytes:126784632 (120.9 MiB)
          Interrupt:16 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:72764 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72764 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4307825 (4.1 MiB)  TX bytes:4307825 (4.1 MiB)

[root@localhost ~]#
 
Old 08-24-2009, 10:02 AM   #6
mahdif
Member
 
Registered: Sep 2006
Distribution: Slackware
Posts: 75

Original Poster
Rep: Reputation: 15
It says it can't connect to X.
 
Old 08-24-2009, 10:05 AM   #7
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
You're probably having some other problem. You might want try install Mandriva with Gnome instead of KDE as the new version is still a little too bleeding edge for production systems, IMVHO.
 
Old 08-24-2009, 10:06 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
As user
Code:
xhost +localhost
or
 xhost +local:
As root
Code:
export DISPLAY=:0
program name to execute

Last edited by repo; 08-24-2009 at 10:07 AM.
 
Old 08-24-2009, 10:09 AM   #9
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Use kdesu or gksu to launch graphical programs as root. It's why they were invented.
 
  


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
Unable to run a GUI app as root using su? vharishankar Linux - General 7 05-25-2005 08:08 AM
Run My APP Under a user other than root working2hard Programming 7 10-11-2004 05:48 PM
[ut2004Demo] impossible to run it ?! Ancien_Do.Urden Linux - Games 1 06-01-2004 04:10 PM
Unable to run app as root ADJenkins Linux - Newbie 6 05-23-2004 05:23 AM
Impossible ti issue su root jeankik Linux - Security 4 02-04-2004 10:36 AM

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

All times are GMT -5. The time now is 06:09 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