Results 1 to 7 of 7
Hi,
I would like to have a program started as root everytime it is being used: without sudo or password. Is it possible? If yes how?
I tried using aliases: ...
- 03-08-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
Starting a program as root without sudo
Hi,
I would like to have a program started as root everytime it is being used: without sudo or password. Is it possible? If yes how?
I tried using aliases: prg 'sudo prg', but I am not satisfied with this solution. Can somebody suggest something different?
The reason for that is I need to start gdb from an IDE (eclipse) and the application I am developing need to be run as root so I need to have gdb always run as root whichever way it is started.
I hope I made the problem clear...
Regards,
Anne
- 03-08-2007 #2
You can do 'chmod u+s ...' for the app, but I don't recommend it.
Linux user #126863 - see http://linuxcounter.net/
- 03-08-2007 #3Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
I tried using this:
setuid(0); + modifying the executable so that it is owned by root and has s bit set.
Problem is this sort of approach does not seem to work with the debugger. I think I need to start the debugger as root and the rest will follow: the application will get root privileges.
Am I right? or did I misunderstand your reply?
- 03-08-2007 #4
i assume you are running into the problem where the application will not start when you are using 'sudo'. If that is the case you could just type 'sudo bash'. You now have root access to anything you do in the command line.
The command line you are in is "Bash". So you are actually running Bash with sudo now. Anything you try to run will most likely start up just fine and you'll have root capabilities with it.
Hope this is what you were looking for, although after re-reading your post, i'm not sure it is.
- 03-08-2007 #5Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
I wish it could be that simple... I tried making a shell script: (gdb_root.sh)
#!/bin/bash
#
sudo gdb $*
and calling this script from the ide instead of gdb but somehow eclipse does not like that... I also posted the problem on the eclipse newsgroup.
I don't think there is a problem with the script just that eclipse doesn't like starting a shell script instead of the debugger...
Thanks anyway!
- 03-08-2007 #6
maybe you could start out by getting doing kind of what i said, tell the script 'sudo bash' then once it does that start the application you're trying to start. i know some apps don't run properly when you sudo them and some don't even start. It might help.
- 03-09-2007 #7Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
Silly me!
The solution explained above (starting a script instead of the program itself) DOES work, you just have to make sure that the script has executable permissions...
Hum... Let put that under the fact that I am still pretty new to linux...
Thanks everybody for the help, it was greatly appreciated!
Anne


Reply With Quote