Active Topics

 


Reply
Thread Tools
Posts: 9 | Thanked: 1 time | Joined on Dec 2007
#1
Hi,

I know this is damn stupid question but I can't find the answer. I'm currently working on a java program which needs to set up some network stuff via ifconfig. I don't want the whole VM to run as root so I thought about writing some smalls C programs calling system(ifconfig...); I could launch from Java via Runtime.getRuntime().getExcec(); to do whatever it needs to set up my interfaces.
To avoid asking for a root password or using rootsh (because it's incompatible to becomeroot which is a bit more popular I guess) I want the set Sticky Bits on my programs to give them root access when a normal user runs them.
The whole system works perfectly on my Desktop machine.
I just call chown root file to make root owner of the file and afterwards chmod +sx file as root to set sticky bit.

The following program returns "root" on my desktop but only user on my N810 (I don't know if Chinook or Diablo, is there a command to display it?) if I start it as a normal user on both systems.
Code:
int main(){
        printf("Start\n");
        system("whoami");
        return 0;
}
Does maemo require a special way to be handled with stuff like that? I could really need some held because I can't figure out why it isn't working proper.

toti
 
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#2
Your normal user on the tablet is "user" not "root." To do something as root you either need to use one of the methods to gain root access (rootsh, becomeroot, etc) -or- you need to execute any commands that need root access as part of the postinst of the .deb package you make.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#3
The rootsh executable in rootsh is setuid during install in the postinst (chmod 4755 /usr/bin/rootsh). You may wish to look at the launchsh.c file: http://repository.maemo.org/extras/p...tsh_1.3.tar.gz
 
Posts: 9 | Thanked: 1 time | Joined on Dec 2007
#4
Hey,
I know that "user" is the normal. Espeacially because of that I wanted to set a setuid as root on the files to give normal users roots privileges. But nothing seems to work. I also tried to whole chmod +sx procedure in oktal mode with chmod 4755 and from an postint script but it didn't work.

ls -l says the following stuff:

Code:
Nokia-N810-23-14:/home/user# ls -l /usr/bin/test
-rwsr-xr-x    1 root     1000         7572 Oct  4 11:54 /usr/bin/test

toti
 
Posts: 9 | Thanked: 1 time | Joined on Dec 2007
#5
Hey,

I got the solution. I had to call the methods
setuid(0);
setgid(0);
In C and it works like on my Desktop now.

toti
 
Reply


 
Forum Jump


All times are GMT. The time now is 06:04.