# wheel and applications



## kr651129 (Jun 4, 2012)

Hey everyone, I've got what is most likely a real simple question.  I'm writing a network manager in C++ just to learn, the app will need root access to modify files and restart the connection so I won't have to run the app as root each time.  When I compile apps I see wheel commands when it's getting compiled.  I'm assuming this is the direction I need to take but I'd like to know if I'm on the right track or if someone can point me to a useful resource for this?

Thank you


----------



## SirDice (Jun 4, 2012)

What do you mean with "wheel commands"?

Your application would need to be setuid root. But be careful! Make a mistake in your program and it can be abused!

http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/secure.html


----------



## fluca1978 (Jun 4, 2012)

kr651129 said:
			
		

> When I compile apps I see wheel commands when it's getting compiled.  I'm assuming this is the direction I need to take but I'd like to know if I'm on the right track or if someone can point me to a useful resource for this?



The _wheel_ group is a special group (like others, operator, and so on) that has some more permissive capabilities on the system. Your application however has to run setuid or thru sudo(1), both are quite dangerous so be sure the application is really well tested.


----------



## expl (Jun 4, 2012)

I would write a simple graphical wrapper around su that would pop a dialog for root password before your application is executed then it would pipe the password to su that would execute your app as root. Make sure to use pipes to transfer the password and dont just put it as an argument or it will show up in process description when you run ps (and similar).

Simplest would be to use shell scriptable dialog toolkit like x11/zenity/, or you can write the wrapper in C++ using toolkit of your choice.


----------



## kr651129 (Jun 4, 2012)

@SirDice -- thank you, I wanted to ask the question and I know I sounded dumb but I didn't know the right vocabulary to ask it

@Expl -- Thanks for the suggestion I may write that first as a starting point

@fluca -- I know what the wheel group is, I just needed a way to ask the question, but thank you.

Thanks for the help everyone


----------



## fluca1978 (Jun 5, 2012)

expl said:
			
		

> I would write a simple graphical wrapper around su that would pop a dialog for root password before your application is executed then it would pipe the password to su that would execute your app as root.



Or you can use the already done kdesu or gsudo or some tool alike.


----------



## expl (Jun 5, 2012)

fluca1978 said:
			
		

> Or you can use the already done kdesu or gsudo or some tool alike.



Well he said he wants to learn, there is no better way to learn than rolling your own.


----------



## kr651129 (Jun 7, 2012)

expl said:
			
		

> Well he said he wants to learn, there is no better way to learn than rolling your own.



Eventually I'd like to roll out my own window manager something similar to xfce.  Not that I need to, but for the same reason any other geek would, just to do it.


----------

