[gobolinux-users] Run a root command thru a daemon as a normal user (adsl-start)

teike teikecorp at yahoo.com.br
Tue Sep 27 04:04:05 GMT 2005


Carlo Calica wrote:
> On 9/25/05, teike <teikecorp at yahoo.com.br> wrote:
> 
>>I read also that if I create a C++ program and suid it, it would work.
>>Lets say an small program to run adsl-start and another to adsl-stop.
>>Or even just one program with a list of allowed commands, that seems a
>>good solution.
>>But I tryed this also, like:
>>
>>$echo -e '#include <stdlib.h>\nmain(){system("id -u");}' >tst.cc
>>$g++ -c tst.cc -o tst.o;g++ -o tst tst.o
>>$chown gobo:gobosafe tst;chmod u+s tst #as gobo
>>$tst #as gobo
>>0
>>$tst #as templogin
>>1002
>>
>>Didnt work.
>>
> 
> 
> A small C wrapper using execl works here.  Maybe system was the problem.
yep worked here too :D #include <unistd.h>

Now I just wonder wich one is more safe, this method or sudo.

sudo seems, at least, better for maintenance :)
> 
> #include <stdlib.h>
> 
> int main(int argc, char *argv[]) {
>         execl("/bin/id", "/bin/id", "-u", (char *) NULL);
> }
> 
> calica at office ~/src]ls wrapper
> wrapper
> calica at office ~/src]./wrapper
> 0
> 
> 
> --
> Carlo J. Calica
> _______________________________________________
> gobolinux-users mailing list
> gobolinux-users at lists.gobolinux.org
> http://lists.gobolinux.org/mailman/listinfo/gobolinux-users
> 


	

	
		
_______________________________________________________ 
Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito mais. Instale agora! 
www.yahoo.com.br/messenger/


More information about the gobolinux-users mailing list