DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Results 1 to 6 of 6

Thread: su commands and superuser permissions

  1. Droid
    jdx's Avatar
    Member #
    33900
    Join Date
    Feb 2010
    Location
    MN
    Posts
    69
    Phone
    Droid
    #1

    su commands and superuser permissions

    I've posted it in another forum, but it doesnt look like anyone knows how to fix the problem there. Soooo....
    I've created a native library, which allows me to run the c 'system' command with my android app.
    But somehow, the "superuser permissions app" asks me for permission for every different command, that i am executing. For example: I do a 'su -c "busybox free"'. The superuser app will ask me whether i want to allow or not, i select allow always and next time I call 'su -c "busybox free"' it does not ask again. However, if i do a 'su -c "whatever"', the superuser app will ask again, even though its the same process. So i end up with having a list in my superuser permissions app, with the same process, but different commands. Does anyone know how to avoid this? I would like to grant permission once for this process and being able to start different su commands.

    Thanks
    CM nightlies @ 1.2Ghz
  2. Sponsor
    DF Advertising
    Join Date
    Nov 2008
    Location
    DroidForums.net
     
     
     
     
  3. Senior Droid
    Fraxinus's Avatar
    Member #
    14387
    Join Date
    Dec 2009
    Location
    New Haven, CT
    Posts
    141
    Phone
    Motorola Droid
    #2
    Can you give a little more info? I won't claim to be a shell ninja, but I've had some experience. It would seem to me that you're using a *parameter* of the command you are issuing with superuser permissions. su -c "busybox free" would execute the busybox free command with the -c parameter specified yes? In that case you would have to allow permission for every command you issue (busybox, chmod, gzip, etc., etc.) regardless of whether or not you're using the -c parameter. Also, this should mean completely different things to different commands right? Maybe I'm missing something....

    EDIT:
    My mistake - I shouldn't have responded before doing a little more research - I never had need of the -c command before. I'll take a stab at this anyway (even though I'm clearly no expert).

    When you specify -c, you're indicating that the shell should execute the command string that follows. From what I see you would typically want to do this when chaining commands --> i.e. 'find ..... -c "mv .... "'. I'm not sure how actual execution happens with -c, but it must still be calling the shell to run that program. That seems to be causing your superuser application to check for permission to execute it. Your problem is that the shell is still executing the command that appears in your string. For each command the permission has to be granted.

    Is there a particular reason you're using -c in the first place?
    Last edited by Fraxinus; 02-26-2010 at 12:14 PM.
    Android, therefore I am.
  4. Droid
    jdx's Avatar
    Member #
    33900
    Join Date
    Feb 2010
    Location
    MN
    Posts
    69
    Phone
    Droid
    #3
    Well, its not about a specific command. It could be "reboot", "busybox something" or anything else.I mean, it works in the terminal emulator too, right?! You type su once, and then you can execute all commands as root, without granting permission for every command.
    CM nightlies @ 1.2Ghz
  5. Senior Droid
    Fraxinus's Avatar
    Member #
    14387
    Join Date
    Dec 2009
    Location
    New Haven, CT
    Posts
    141
    Phone
    Motorola Droid
    #4
    Are you executing these commands directly from a terminal emulator? From my experience, yes, when you allow access to su once all subsequent su commands will simply execute. As soon as you leave that particular session though, you would have to grant permission again. I'm basing this off desktop linux systems though, I haven't played much with a terminal in Android.
    Android, therefore I am.
  6. Droid
    jdx's Avatar
    Member #
    33900
    Join Date
    Feb 2010
    Location
    MN
    Posts
    69
    Phone
    Droid
    #5
    Its like that:
    - I have a native lib, which executes the c command "system"
    - I am calling this function in my android app with params (like myfunction("reboot"))
    I thought, once i do a myfunction("su"), my app will have su rights (if 'white listed' in the superuser permissions app). But i have to white list every command. What am i doing wrong?
    CM nightlies @ 1.2Ghz
  7. Senior Droid
    Fraxinus's Avatar
    Member #
    14387
    Join Date
    Dec 2009
    Location
    New Haven, CT
    Posts
    141
    Phone
    Motorola Droid
    #6
    Sorry in advance if I'm being slow on this...a question:
    When you say you're launching this from your "Android app" are you writing a custom application that makes calls to the c 'system' function?

    Or are you issuing a command like 'su -c "busybox free"' from the command line?

    If the latter is the case then for your example all you're doing is telling one shell to launch another shell to execute the command. This is useful for chaining commands together

    find /path/to/images -name '*.JPG' -exec bash -c 'mv "$1" "${1/%.JPG/.jpg}"' -- {} \;

    Rename .JPG to .jpg recursively
    Recursively rename .JPG to .jpg using standard find and mv. It's generally better to use a standard tool if doing so is not much more difficult.
    (taken from: Commands using bash | commandlinefu.com)

    but there isn't really any benefit from calling a single command...that I'm aware of.

    I'll throw this out there too. I have *no* idea if this will help you, but you can check this link out:

    calling "system" command from C - Mac Forums

    If this is going nowhere for you and I'm not being helpful let me know and we can stop going in circles!
    Android, therefore I am.

Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Replies: 4
    Last Post: 02-14-2010, 01:31 PM
  2. superuser permission
    By jeff.essy in forum Droid Hacks
    Replies: 0
    Last Post: 01-09-2010, 08:24 AM
  3. How do you get superuser permissions off??
    By thathxckid in forum Droid Hacks
    Replies: 0
    Last Post: 01-05-2010, 07:39 PM
  4. Superuser App on HC 2.1 ROM?
    By wuyanks in forum Droid Hacks
    Replies: 3
    Last Post: 01-05-2010, 11:06 AM
  5. Superuser App?
    By wuyanks in forum Droid Hacks
    Replies: 4
    Last Post: 12-09-2009, 02:42 PM

Search tags for this page

add app to superuser android
,

android su command

,

android su commands

,
android superuser commands
,
android superuser permissions
,
android terminal emulator commands list
,
android terminal emulator superuser
,
android terminal superuser
,
how to add apps to superuser
,
how to add apps to superuser android
,

su command android

,
su command in android
,
su commands android
,
superuser commands
,
superuser commands android
Click on a term to search our site for related topics.
Find us on Google+