You are not logged in.

#1 2007-09-16 15:08:44

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

[SOLVED]How can I execute a program being a root as an user?

Hello, I'm editing the acpi multimedia keys, exactly editing /etc/acpi/handler.sh file.

When I put a scpecific command for a key (for example, firefox) it is executed as a root, not as the user I'm logged on.

What can I do to execute the programs with the multimedia keys as a normal user, and not as a root?

Greetings

Last edited by Davigetto (2007-09-16 16:28:12)


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#2 2007-09-16 15:12:02

harlekin
Member
From: Germany
Registered: 2006-07-13
Posts: 408

Re: [SOLVED]How can I execute a program being a root as an user?

sudo -u username command

Maybe this will work for you. But the fact that the user have to be specified in the file and won't be fetched on key press may be a problem.


Hail to the thief!

Offline

#3 2007-09-16 15:40:09

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

Re: [SOLVED]How can I execute a program being a root as an user?

I have tried it but terminal does nothing as root :S

[root@helena davigetto]# sudo -u davigetto firefox
[root@helena davigetto]#

And firefox is not opened hmm


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#4 2007-09-16 15:58:08

Mardukas
Banned
From: Lithuania
Registered: 2007-08-05
Posts: 121

Re: [SOLVED]How can I execute a program being a root as an user?

Davigetto wrote:

I have tried it but terminal does nothing as root :S

[root@helena davigetto]# sudo -u davigetto firefox
[root@helena davigetto]#

And firefox is not opened hmm

Try kdesu -u davigetto firefox (if you're using KDE, if GNOME - gksudo).

Offline

#5 2007-09-16 16:01:35

robertp
Member
From: Warszawa, Poland
Registered: 2007-09-11
Posts: 123

Re: [SOLVED]How can I execute a program being a root as an user?

This should work for you (it has worked for me for a long time).
Check whether DISPLAY and  XAUTHORITY environment variables are set correctly.
Try running simpler program like xclock or xcalc.
Also try this with su instead of sudo, like this:

 su username -c command

Offline

#6 2007-09-16 16:27:55

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

Re: [SOLVED]How can I execute a program being a root as an user?

thanks all,

robertp solution has worked perfectly, thank you very much big_smile


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

Board footer

Powered by FluxBB