Click to See Complete Forum and Search --> : How can i force X programs to run as root?


Duh
08-25-2001, 11:12 PM
like when i launch Red-Carpet, it automatically asks for the root password. how can i make other programs do that?
RH 7.1 if you care.

stiles
08-25-2001, 11:46 PM
you really can't make a program prompt you for a password unless the program runs some permission checks and the provides an interface to su for that program instance. You can, but you would have to hack the code to provide that type of functionality.

You can do something else though. Create a group and add your user to this new group (or you can use your user's private group, which is the same name as your user's name). Then chgrp the executable to this new group (still owned by root). Now set the guid bit (chmod g+s <file>, I think the group execute bit already has to be set). It won't prompt that user, but it will run. Not the most secure thing in the world to do but if you don't have someone trying to break out of that shell account it's a non issue.

jrbush82
08-25-2001, 11:54 PM
or you could make it easier...

create a script

#!/bin/bash
su
paswordhere
programtoexecute

just put that in a file, make it executable and put it in /usr/bin

one thing is to make sure you set permissions so that others cannot view it because the root password will be written plainly, if you are the only user, then there wouldn't be a problem.

Tyr-7BE
08-26-2001, 12:24 AM
That won't work...su can't be done interactively that way...not with bash at least.

jrbush82
08-26-2001, 01:06 AM
heh,, shows what I know, hehe

Malakin
08-26-2001, 04:39 AM
If you're using KDE, right click on the icon that executes the program, click on the execute tab, tick the "run as different user" box and type in "root".

Simple as that :)

Duh
08-26-2001, 08:53 AM
oh well. use gnome so cant do the kde thing. someday they'll add it in.
thanks!

Sidey
08-26-2001, 09:17 AM
I'm not sure but I think kde has a program called kdesu. So for example, running 'kdesu konqueror' will run konqueror as root and ask you for the password. This program works in gnome. You just need kde installed.

hope this helps,
rich

ethereal
08-26-2001, 02:47 PM
it's actually simple, the problem is it doesn't work with gtk.

run the command # chmod +s /your/program

this must be done as root, after you do this the program will run as if it's being run by root.

Sometimes you can get around the gtk thing, I use the program gcombust to burn cd's, which uses gtk. All I have to do is chmod +s the program cdrecord, then I can run the frontend as a user but he core program(cdrecord) is run as root.

Hope this helps.

[ 26 August 2001: Message edited by: ethereal ]